diff --git a/CODING_STANDARDS.md b/CODING_STANDARDS.md index 3ecf73768e3..4310fb553e7 100644 --- a/CODING_STANDARDS.md +++ b/CODING_STANDARDS.md @@ -125,16 +125,54 @@ Consecutive functions should be separated with 2 empty lines in between ```cpp void my_function_1() { - + } void my_function_2() { - + } ``` +#### Preprocessor directives + +Compiler preprocessor directives should have no indentation to them, even if in the middle of indented code. +For example: + +```c + case SSL_TYPE_NONE: // SSL is not required + if (opt_require_secure_transport) + { + enum enum_vio_type type= vio_type(vio); +#ifdef HAVE_OPENSSL + return type != VIO_TYPE_SSL && +#ifndef _WIN32 + type != VIO_TYPE_SOCKET; +#else + type != VIO_TYPE_NAMEDPIPE; +#endif +#else +#ifndef _WIN32 + return type != VIO_TYPE_SOCKET; +#else + return type != VIO_TYPE_NAMEDPIPE; +#endif +#endif + } +``` + +Comments reflecting the original `#if` condition can be appended to `#else` / `#endif` to provide additional clarity. This can be useful for large code blocks between the start and end preprocessor directives or nested preprocessor directives. +For example: + +```c +#ifndef EMBEDDED_LIBRARY +... +#else /* ! EMBEDDED_LIBRARY */ +... +#endif /* ! EMBEDDED_LIBRARY */ +``` + ### File names File names should be lower case with underscore word separators. diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index a8d3e042536..214cca2d7d5 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -319,6 +319,7 @@ ENDIF() # MDEV-24629, we need it outside of ELSIFs IF(RPM MATCHES "fedora") ALTERNATIVE_NAME("common" "mariadb-connector-c-config" ${MARIADB_CONNECTOR_C_VERSION}-1) + ALTERNATIVE_NAME("shared" "mariadb-connector-c" ${MARIADB_CONNECTOR_C_VERSION}-1) ENDIF() SET(PYTHON_SHEBANG "/usr/bin/python3" CACHE STRING "python shebang") diff --git a/debian/control b/debian/control index 09d5dce0e6c..ace61a35c26 100644 --- a/debian/control +++ b/debian/control @@ -566,9 +566,7 @@ Description: MariaDB database client binaries Package: mariadb-client-compat Architecture: all Depends: mariadb-client (>= ${source:Version}) -Multi-Arch: foreign -Description: MySQL compatibility links to mariadb-client binaries/scripts. -Conflicts: mariadb-client (< 11.0.0), +Conflicts: mariadb-client (<< 11.0.0), mariadb-client-10.0, mariadb-client-10.1, mariadb-client-10.2, @@ -582,7 +580,7 @@ Conflicts: mariadb-client (< 11.0.0), mariadb-client-5.2, mariadb-client-5.3, mariadb-client-5.5, - mariadb-client-core (< 11.0.0), + mariadb-client-core (<< 11.0.0), mariadb-client-core-10.0, mariadb-client-core-10.1, mariadb-client-core-10.2, @@ -610,7 +608,7 @@ Conflicts: mariadb-client (< 11.0.0), mysql-client-core-5.6, mysql-client-core-5.7, mysql-client-core-8.0, - mariadb-server (< 11.0.0), + mariadb-server (<< 11.0.0), mariadb-server-10.0, mariadb-server-10.1, mariadb-server-10.2, @@ -620,7 +618,7 @@ Conflicts: mariadb-client (< 11.0.0), mariadb-server-10.6, mariadb-server-10.7, mariadb-server-10.8, - mariadb-server-core (< 11.0.0), + mariadb-server-core (<< 11.0.0), mariadb-server-core-10.0, mariadb-server-core-10.1, mariadb-server-core-10.2, @@ -637,6 +635,13 @@ Conflicts: mariadb-client (< 11.0.0), percona-xtradb-cluster-server-5.6, percona-xtradb-cluster-server-5.7, percona-xtradb-cluster-server +Multi-Arch: foreign +Description: MySQL compatibility links to mariadb-client binaries/scripts. + The package contains links and binaries that are needed by MySQL centric + tools which also works with MariaDB. + . + This package is also useful for users with strong background in MySQL + maintenance, but wants to switch to MariaDB Package: mariadb-server-core Architecture: any @@ -861,9 +866,7 @@ Description: MariaDB database server binaries Package: mariadb-server-compat Architecture: all Depends: mariadb-server (>= ${source:Version}), -Multi-Arch: foreign -Description: MySQL compatibility links to mariadb-server binaries/scripts. -Conflicts: mariadb-server-core (< 11.0.0), +Conflicts: mariadb-server-core (<< 11.0.0), mariadb-server-core-10.0, mariadb-server-core-10.1, mariadb-server-core-10.2, @@ -877,7 +880,7 @@ Conflicts: mariadb-server-core (< 11.0.0), mariadb-server-core-5.2, mariadb-server-core-5.3, mariadb-server-core-5.5, - mariadb-server (< 11.0.0), + mariadb-server (<< 11.0.0), mariadb-server-10.0, mariadb-server-10.1, mariadb-server-10.2, @@ -904,6 +907,13 @@ Conflicts: mariadb-server-core (< 11.0.0), percona-xtradb-cluster-server-5.6, percona-xtradb-cluster-server-5.7, percona-xtradb-cluster-server +Multi-Arch: foreign +Description: MySQL compatibility links to mariadb-server binaries/scripts. + The package contains links and binaries that are needed by MySQL centric + tools which also works with MariaDB. + . + This package is also useful for users with strong background in MySQL + maintenance, but wants to switch to MariaDB Package: mariadb-backup Architecture: any diff --git a/debian/mariadb-plugin-provider-bzip2.lintian-overrides b/debian/mariadb-plugin-provider-bzip2.lintian-overrides index 47298832bcf..50e280b56da 100644 --- a/debian/mariadb-plugin-provider-bzip2.lintian-overrides +++ b/debian/mariadb-plugin-provider-bzip2.lintian-overrides @@ -1,3 +1,4 @@ # 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 library-not-linked-against-libc [usr/lib/mysql/plugin/provider_bzip2.so] diff --git a/debian/mariadb-plugin-provider-lz4.lintian-overrides b/debian/mariadb-plugin-provider-lz4.lintian-overrides index dbfde133135..4df09a0af4e 100644 --- a/debian/mariadb-plugin-provider-lz4.lintian-overrides +++ b/debian/mariadb-plugin-provider-lz4.lintian-overrides @@ -1,3 +1,4 @@ # 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 library-not-linked-against-libc [usr/lib/mysql/plugin/provider_lz4.so] diff --git a/debian/mariadb-plugin-provider-lzma.lintian-overrides b/debian/mariadb-plugin-provider-lzma.lintian-overrides index 79f6cb793c2..2d9f4b8adc2 100644 --- a/debian/mariadb-plugin-provider-lzma.lintian-overrides +++ b/debian/mariadb-plugin-provider-lzma.lintian-overrides @@ -1,3 +1,4 @@ # 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 library-not-linked-against-libc [usr/lib/mysql/plugin/provider_lzma.so] diff --git a/debian/mariadb-plugin-provider-lzo.lintian-overrides b/debian/mariadb-plugin-provider-lzo.lintian-overrides index ccca4e2d355..13015fde854 100644 --- a/debian/mariadb-plugin-provider-lzo.lintian-overrides +++ b/debian/mariadb-plugin-provider-lzo.lintian-overrides @@ -1,3 +1,4 @@ # 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 library-not-linked-against-libc [usr/lib/mysql/plugin/provider_lzo.so] diff --git a/debian/mariadb-plugin-provider-snappy.lintian-overrides b/debian/mariadb-plugin-provider-snappy.lintian-overrides index b62907c3469..2ddf25d0dd0 100644 --- a/debian/mariadb-plugin-provider-snappy.lintian-overrides +++ b/debian/mariadb-plugin-provider-snappy.lintian-overrides @@ -1,3 +1,4 @@ # 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 library-not-linked-against-libc [usr/lib/mysql/plugin/provider_snappy.so] diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml index 15626d2afbc..f5ffab99026 100644 --- a/debian/salsa-ci.yml +++ b/debian/salsa-ci.yml @@ -56,6 +56,14 @@ build i386: script: - *autobake-deb-steps +build bullseye-backports: + extends: .build-package + variables: + RELEASE: bullseye-backports + +# Buster only has libfmt 6.1 but 7.0 is required, so backport build for Buster +# is not possible unless somebody packages libfmt7-dev for Buster. + build sid: extends: .build-package script: @@ -112,6 +120,12 @@ blhc: mysql --table -e "SELECT * FROM plugin;" mysql mysql --table -e "SHOW PLUGINS;" mysql +# Readline was removed from Debian Sid (and Bullseye) in Feb 2021. To be able to install older +# versions of MariaDB that depend on it, fetch and install it from Buster. +.test-install-readline-in-sid-for-backwards-compat: &test-install-readline-in-sid-for-backwards-compat | + curl -sS -O http://ftp.de.debian.org/debian/pool/main/r/readline5/libreadline5_5.2+dfsg-3+b13_amd64.deb + apt-get -qq install --no-install-recommends --yes ./libreadline5_5.2+dfsg-3+b13_amd64.deb + .test-enable-bullseye-repos: &test-enable-bullseye-repos # Replace any old repos with just Sid - echo 'deb http://deb.debian.org/debian bullseye main' > /etc/apt/sources.list @@ -119,6 +133,17 @@ blhc: - apt-get update -qq - apt-get install -y apt +.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-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 @@ -130,16 +155,28 @@ blhc: 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-enable-sid-repos: &test-enable-sid-repos + # Apply usrmerge workaround for Stretch/Buster/Bullseye to Bookworm/Sid upgrades + - echo 'this system will not be supported in the future' > /etc/unsupported-skip-usrmerge-conversion + # Replace any old repos with just Sid + - echo 'deb http://deb.debian.org/debian sid main' > /etc/apt/sources.list + # Upgrade minimal stack first + - apt-get update -qq + # Next step will fail on https://bugs.debian.org/993755 + # /usr/bin/perl: error while loading shared libraries: libcrypt.so.1: cannot + # open shared object file: No such file or directory + # dpkg: error processing package libc6:amd64 (--configure): + - apt-get install -y apt || true + # Apply workaround + - cd $(mktemp -d) # Use temp dir where apt can download and unpack files + - apt-get -y download libcrypt1 + - dpkg-deb -x libcrypt1_*.deb . + - cp -ra lib/* /lib/ + - cd - # Back to /builds/$USER/mariadb-server/debian/output + - find /lib/*/libcrypt.* -ls # Show that new libcrypt is there + - apt-get -y --fix-broken install + # Complete upgrade of minimal stack + - apt-get install -y apt .test-install: &test-install # Install MariaDB built in this commit @@ -252,35 +289,6 @@ mariadb-10.5 Bullseye upgrade: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -mariadb-10.3 with Buster backports upgrade: - stage: upgrade extras - needs: - - job: build buster-backports - image: debian:buster - artifacts: - when: always - name: "$CI_BUILD_NAME" - paths: - - ${WORKING_DIR}/debug - script: - - *test-prepare-container - # 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 - # 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 - except: - variables: - - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ - mariadb-10.3 Buster upgrade: stage: upgrade from Buster needs: @@ -490,6 +498,43 @@ mysql-8.0 from Ubuntu 22.04 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-community-cluster-8.0 from MySQL.com upgrade: + stage: upgrade extras + needs: + - job: build + image: debian:${RELEASE} + artifacts: + when: always + name: "$CI_BUILD_NAME" + paths: + - ${WORKING_DIR}/debug + script: + - *test-prepare-container + - 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 + # 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: + GIT_STRATEGY: none + except: + variables: + - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ + mariadb.org 10.11 to mariadb upgrade: stage: upgrade extras needs: @@ -570,7 +615,7 @@ mariadb.org 10.9 to mariadb upgrade: - 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.9/debian ${RELEASE} main" > /etc/apt/sources.list.d/mariadb.list - apt-get update - - apt-get install -y mariadb-server + - apt-get install -y mariadb-server-10.9 mariadb-client-10.9 - *test-verify-initial # Install MariaDB built in this commit # Force downgrades so our version installs on top of upstream revision, e.g. 1:10.9.1-1 vs 1:10.9.1+mariadb~sid @@ -618,43 +663,6 @@ mariadb.org-10.8 to mariadb 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-community-cluster-8.0 from MySQL.com upgrade: - stage: upgrade extras - needs: - - job: build - image: debian:${RELEASE} - artifacts: - when: always - name: "$CI_BUILD_NAME" - paths: - - ${WORKING_DIR}/debug - script: - - *test-prepare-container - - 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 - # 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: - GIT_STRATEGY: none - except: - variables: - - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ - mariadb.org-10.7 to mariadb upgrade: stage: upgrade extras needs: @@ -746,11 +754,11 @@ mariadb.org-10.5 to mariadb upgrade: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -mariadb.org-10.4 to mariadb with Buster backports upgrade: +mariadb.org-10.4 to mariadb upgrade: stage: upgrade extras needs: - - job: build buster-backports - image: debian:buster + - job: build + image: debian:${RELEASE} artifacts: when: always name: "$CI_BUILD_NAME" @@ -762,6 +770,7 @@ mariadb.org-10.4 to mariadb with Buster backports upgrade: - curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc - echo "deb https://archive.mariadb.org/mariadb-10.4/repo/debian buster main" > /etc/apt/sources.list.d/mariadb.list - apt-get update -qq + - *test-install-readline-in-sid-for-backwards-compat - 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 @@ -780,11 +789,11 @@ mariadb.org-10.4 to mariadb with Buster backports upgrade: variables: - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ -mariadb.org-10.3 to mariadb with Buster backports upgrade: +mariadb.org-10.3 to mariadb upgrade: stage: upgrade extras needs: - - job: build bullseye-backports - image: debian:bullseye + - job: build + image: debian:${RELEASE} artifacts: when: always name: "$CI_BUILD_NAME" @@ -796,6 +805,7 @@ mariadb.org-10.3 to mariadb with Buster backports upgrade: - curl -sS https://mariadb.org/mariadb_release_signing_key.asc -o /etc/apt/trusted.gpg.d/mariadb.asc - echo "deb https://archive.mariadb.org/mariadb-10.3/repo/debian buster main" > /etc/apt/sources.list.d/mariadb.list - apt-get update -qq + - *test-install-readline-in-sid-for-backwards-compat - apt-get install -y mariadb-server-10.3 - *test-verify-initial # Buster backports is needed for liburing1 (>= 0.7) and galera-4 (>= 26.4) diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides index fc7a8780651..68f84851d6c 100644 --- a/debian/source/lintian-overrides +++ b/debian/source/lintian-overrides @@ -1,3 +1,6 @@ +# MariaDB use high enough debhelper so this is should +# be considered as bug in lintia +missing-build-dependency-for-dh-addon systemd * # Necessary for drop-in-place-replacement upgrades on mysql-server/-client # since package breaks/replaces these but at the same time also provides them version-substvar-for-external-package mariadb-client-core -> mysql-client-5.5 diff --git a/include/m_string.h b/include/m_string.h index 6a645b20a7f..28ad9ee7c88 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -201,7 +201,7 @@ extern ulonglong strtoull(const char *str, char **ptr, int base); #ifdef __cplusplus #include -template inline const char *_swl_check(T s) +template inline constexpr const char *_swl_check(T s) { static_assert(std::is_same::value || std::is_same::value, diff --git a/include/my_compiler.h b/include/my_compiler.h index 831929cf5ab..43b0e48f72c 100644 --- a/include/my_compiler.h +++ b/include/my_compiler.h @@ -40,7 +40,15 @@ /* GNU C/C++ */ #if defined __GNUC__ # define MY_ALIGN_EXT -# define MY_ASSERT_UNREACHABLE() __builtin_unreachable() + +/* + __builtin_unreachable() removes the "statement may fall through" warning-as- + error when MY_ASSERT_UNREACHABLE() is used in "case xxx:" in switch (...) + statements. + abort() is there to prevent the execution from reaching the + __builtin_unreachable() as this may cause misleading stack traces. +*/ +# define MY_ASSERT_UNREACHABLE() { abort(); __builtin_unreachable(); } /* Microsoft Visual C++ */ #elif defined _MSC_VER @@ -88,7 +96,7 @@ #endif #ifndef MY_ASSERT_UNREACHABLE -# define MY_ASSERT_UNREACHABLE() do { assert(0); } while (0) +# define MY_ASSERT_UNREACHABLE() do { abort(); } while (0) #endif /** diff --git a/man/comp_err.1 b/man/comp_err.1 index 1603ddf51de..6f000869797 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\&.10" "MariaDB Database System" +.TH "\fBCOMP_ERR\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/galera_new_cluster.1 b/man/galera_new_cluster.1 index d7efa7c84be..4e03abf1d3c 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\&.10" "MariaDB Database System" +.TH "\fBGALERA_NEW_CLUSTER\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/galera_recovery.1 b/man/galera_recovery.1 index 90fbe67cbc0..18da2fa5fd0 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\&.10" "MariaDB Database System" +.TH "\fBGALERA_RECOVERY\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/innochecksum.1 b/man/innochecksum.1 index 56e4f43dbd4..f149a5cc2d4 100644 --- a/man/innochecksum.1 +++ b/man/innochecksum.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBINNOCHECKSUM\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBINNOCHECKSUM\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-access.1 b/man/mariadb-access.1 index 4d9e4902dae..762c1959584 100644 --- a/man/mariadb-access.1 +++ b/man/mariadb-access.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-ACCESS\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-ACCESS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -400,7 +400,7 @@ script at approximately line 18\&. Search for a line that looks like this: .RS 4 .\} .nf -$MYSQL = \'/usr/local/bin/mysql\'; # path to mysql executable +$MYSQL = '/usr/local/bin/mysql'; # path to mysql executable .fi .if n \{\ .RE diff --git a/man/mariadb-admin.1 b/man/mariadb-admin.1 index da25123a219..82c5dfc01fa 100644 --- a/man/mariadb-admin.1 +++ b/man/mariadb-admin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-ADMIN\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-ADMIN\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -22,7 +22,7 @@ mariadb-admin \- client for administering a MariaDB server (mysqladmin is now a .SH "DESCRIPTION" .PP \fBmysqladmin\fR -is a client for performing administrative operations\&. You can use it to check the server\'s configuration and current status, to create and drop databases, and more\&. +is a client for performing administrative operations\&. You can use it to check the server's configuration and current status, to create and drop databases, and more\&. .PP Invoke \fBmysqladmin\fR @@ -763,7 +763,7 @@ If you execute \fBmysqladmin shutdown\fR when connecting to a local server using a Unix socket file, \fBmysqladmin\fR -waits until the server\'s process ID file has been removed, to ensure that the server has stopped properly\&. +waits until the server's process ID file has been removed, to ensure that the server has stopped properly\&. .\" mysqladmin command options .\" command options: mysqladmin .\" options: command-line: mysqladmin @@ -871,9 +871,7 @@ option is given\&. .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is -\'d:t:o,\fIfile_name\fR\'\&. The default is -\'d:t:o,/tmp/mysqladmin\&.trace\'\&. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqladmin.trace'. .RE .sp .RS 4 @@ -1103,7 +1101,7 @@ On Windows, connect to the server via a named pipe\&. This option applies only i \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp -The TCP/IP port number to use for the connection or 0 for default to, +The TCP/IP port number to use for the connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306)\&. Forces --protocol=tcp when specified on the command line without other connection properties\&. .RE @@ -1243,7 +1241,7 @@ Forces --protocol=socket when specified on the command line without other connec .\" SSL options: mysqladmin \fB\-\-ssl\fR .sp -Enable SSL for connection (automatically enabled with other flags). Disable with +Enable SSL for connection (automatically enabled with other flags). Disable with \fB\-\-skip-ssl\fR\&. .RE .sp @@ -1386,7 +1384,7 @@ Verify server's "Common Name" in its cert against hostname used when connecting. .\" TLS Version option: mysqladmin \fB\-\-tls\-version=\fR\fB\fIname\fR\fR, .sp -Accepts a comma-separated list of TLS protocol versions\&. A TLS protocol version will only be enabled if it +Accepts a comma-separated list of TLS protocol versions\&. A TLS protocol version will only be enabled if it is present in this list\&. All other TLS protocol versions will not be permitted\&. .RE .sp @@ -1485,7 +1483,7 @@ value is given, it indicates the number of times to retry\&. The default is one .\" --wait-for-all-slaves option: mysqladmin \fB\-\-wait\-for\-all\-slaves\fR .sp -Wait for the last binlog event to be sent to all connected slaves before shutting down\&. +Wait for the last binlog event to be sent to all connected slaves before shutting down\&. This option is off by default\&. .RE .PP diff --git a/man/mariadb-backup.1 b/man/mariadb-backup.1 index 4ee0a2f09d4..705234fe67b 100644 --- a/man/mariadb-backup.1 +++ b/man/mariadb-backup.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIABACKUP\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIABACKUP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-binlog.1 b/man/mariadb-binlog.1 index 8dd814d34ab..70636d55e2f 100644 --- a/man/mariadb-binlog.1 +++ b/man/mariadb-binlog.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-BINLOG\FR" "1" "14 April 2021" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-BINLOG\fR" "1" "14 April 2021" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -19,7 +19,7 @@ mariadb-binlog \- utility for processing binary log files (mysqlbinlog is now a \fBmysqlbinlog [\fR\fBoptions\fR\fB] \fR\fB\fIlog_file\fR\fR\fB \&.\&.\&.\fR .SH "DESCRIPTION" .PP -The server\'s binary log consists of files containing +The server's binary log consists of files containing \(lqevents\(rq that describe modifications to database contents\&. The server writes these files in binary format\&. To display their contents in text format, use the \fBmysqlbinlog\fR @@ -400,7 +400,7 @@ INSERT statements following USE db2\&. .PP -\fBRow-based logging\fR. +\fBRow-based logging\fR. \fBmysqlbinlog\fR outputs only entries that change tables belonging to \fIdb_name\fR\&. The default database has no effect on this\&. Suppose that the binary log just described was created using row\-based logging rather than statement\-based logging\&. @@ -455,9 +455,7 @@ with row\-based logging prior to MySQL 5\&.1\&.37\&. .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is -\'d:t:o,\fIfile_name\fR\'\&. The default is -\'d:t:o,/tmp/mysqlbinlog\&.trace\'\&. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqlbinlog.trace'. .RE .sp .RS 4 @@ -725,7 +723,7 @@ option on the command line, \fBmysqlbinlog\fR prompts for one\&. .sp -Specifying a password on the command line should be considered insecure\&. You +Specifying a password on the command line should be considered insecure\&. You can use an option file to avoid giving the password on the command line\&. .RE .sp @@ -772,8 +770,8 @@ Print the program argument list from all option files and exit\&. \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp -The TCP/IP port number to use for connecting to a remote server, -or \fB0\fR for default to, in order of preference, \fBmy.cnf\fR, +The TCP/IP port number to use for connecting to a remote server, +or \fB0\fR for default to, in order of preference, \fBmy.cnf\fR, \fB$MYSQL_TCP_PORT\fR, \fB/etc/services\fR, \fRbuilt-in default (3306)\fR\&. Forces --protocol=tcp when specified on the command line without other connection properties\&. .RE @@ -861,16 +859,16 @@ Direct output to the given file\&. With --raw this is a prefix for the file name \fB\-\-rewrite\-db=\fR\fB\fIname\fR\fR, \fB\-r \fR\fB\fIname\fR\fR .sp -Updates to a database with a different name than the original. -Example: \fBrewrite-db='from->to'\fR\&. For events that are -binlogged as statements, rewriting the database constitutes changing a -statement's default database from \fIdb1\fB to \fIdb2\fR\&. There is no statement +Updates to a database with a different name than the original. +Example: \fBrewrite-db='from->to'\fR\&. For events that are +binlogged as statements, rewriting the database constitutes changing a +statement's default database from \fIdb1\fB to \fIdb2\fR\&. There is no statement analysis or rewrite of any kind, that is, if one specifies \fB"db1.tbl"\fR -in the statement explicitly, that occurrence won't be changed to -\fB"db2.tbl"\fR\&. Row-based events are rewritten correctly to use the new -database name\&. Filtering (e.g. with \fB--database=name\fR) happens after -the database rewrites have been performed\&. If you use this option on the -command line and \fB">"\fR has a special meaning to your command interpreter, +in the statement explicitly, that occurrence won't be changed to +\fB"db2.tbl"\fR\&. Row-based events are rewritten correctly to use the new +database name\&. Filtering (e.g. with \fB--database=name\fR) happens after +the database rewrites have been performed\&. If you use this option on the +command line and \fB">"\fR has a special meaning to your command interpreter, quote the value (e.g. \fB--rewrite-db="oldname->newname"\fR\&. .RE .sp @@ -919,9 +917,9 @@ statement to the output to specify the character set to be used for processing l \fB\-\-short\-form\fR, \fB\-s\fR .sp -Display only the statements contained in the log, no extra info -and no row-based events\&. This is for testing only, and should -not be used in production systems. If you want to suppress +Display only the statements contained in the log, no extra info +and no row-based events\&. This is for testing only, and should +not be used in production systems. If you want to suppress base64-output, consider using \fB--base64-output=never\fR instead\&. .RE .sp @@ -1210,7 +1208,7 @@ You can pipe the output of \fBmysqlbinlog\fR into the \fBmysql\fR -client to execute the events contained in the binary log\&. This technique is used to recover from a crash when you have an old +client to execute the events contained in the binary log\&. This technique is used to recover from a crash when you have an old backup\&. For example: .sp .if n \{\ @@ -1422,11 +1420,8 @@ Position: The byte position within the log file\&. .sp -1 .IP \(bu 2.3 .\} -Timestamp: The event timestamp\&. In the example shown, -\'9d fc 5c 43\' -is the representation of -\'051024 17:24:13\' -in hexadecimal\&. +Timestamp: The event timestamp\&. In the example shown, '9d fc 5c 43' +is the representation of '051024 17:24:13' in hexadecimal\&. .RE .sp .RS 4 @@ -1437,9 +1432,7 @@ in hexadecimal\&. .sp -1 .IP \(bu 2.3 .\} -Type: The event type code\&. In the example shown, -\'0f\' -indicates a +Type: The event type code\&. In the example shown, '0f' indicates a FORMAT_DESCRIPTION_EVENT\&. The following table lists the possible type codes\&. .TS allbox tab(:); @@ -1729,14 +1722,11 @@ T}:T{ .nf LOG_EVENT_BINLOG_IN_USE_F T}:T{ -Log file correctly closed\&. (Used only in -FORMAT_DESCRIPTION_EVENT\&.) If -this flag is set (if the flags are, for example, -\'01 00\') in a -FORMAT_DESCRIPTION_EVENT, the log -file has not been properly closed\&. Most probably -this is because of a master crash (for example, due -to power failure)\&. +Log file correctly closed\&. (Used only in FORMAT_DESCRIPTION_EVENT\&.) If this +flag is set (if the flags are, for example, '01 00') in a +FORMAT_DESCRIPTION_EVENT, the log file has not been properly closed\&. Most +probably this is because of a master crash (for example, due to power +failure)\&. T} T{ 02 @@ -1752,7 +1742,7 @@ T}:T{ LOG_EVENT_THREAD_SPECIFIC_F T}:T{ Set if the event is dependent on the connection it was executed in (for -example, \'04 00\'), for example, +example, '04 00'), for example, if the event uses temporary tables\&. T} T{ @@ -1794,8 +1784,8 @@ CREATE TABLE t date DATE NULL ) ENGINE = InnoDB; START TRANSACTION; -INSERT INTO t VALUES(1, \'apple\', NULL); -UPDATE t SET name = \'pear\', date = \'2009\-01\-01\' WHERE id = 1; +INSERT INTO t VALUES(1, 'apple', NULL); +UPDATE t SET name = 'pear', date = '2009\-01\-01' WHERE id = 1; DELETE FROM t WHERE id = 1; COMMIT; .fi @@ -1817,24 +1807,18 @@ shell> \fBmysqlbinlog \fR\fB\fIlog_file\fR\fR \&.\&.\&. # at 218 #080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F -BINLOG \' -fAS3SBMBAAAALAAAANoAAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= -fAS3SBcBAAAAKAAAAAIBAAAQABEAAAAAAAEAA//8AQAAAAVhcHBsZQ== -\'/*!*/; +BINLOG 'fAS3SBMBAAAALAAAANoAAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= +fAS3SBcBAAAAKAAAAAIBAAAQABEAAAAAAAEAA//8AQAAAAVhcHBsZQ=='/*!*/; \&.\&.\&. # at 302 #080828 15:03:08 server id 1 end_log_pos 356 Update_rows: table id 17 flags: STMT_END_F -BINLOG \' -fAS3SBMBAAAALAAAAC4BAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= -fAS3SBgBAAAANgAAAGQBAAAQABEAAAAAAAEAA////AEAAAAFYXBwbGX4AQAAAARwZWFyIbIP -\'/*!*/; +BINLOG 'fAS3SBMBAAAALAAAAC4BAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= +fAS3SBgBAAAANgAAAGQBAAAQABEAAAAAAAEAA////AEAAAAFYXBwbGX4AQAAAARwZWFyIbIP'/*!*/; \&.\&.\&. # at 400 #080828 15:03:08 server id 1 end_log_pos 442 Delete_rows: table id 17 flags: STMT_END_F -BINLOG \' -fAS3SBMBAAAALAAAAJABAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= -fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP -\'/*!*/; +BINLOG 'fAS3SBMBAAAALAAAAJABAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= +fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP'/*!*/; .fi .if n \{\ .RE @@ -1859,43 +1843,37 @@ shell> \fBmysqlbinlog \-v \fR\fB\fIlog_file\fR\fR \&.\&.\&. # at 218 #080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F -BINLOG \' -fAS3SBMBAAAALAAAANoAAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= -fAS3SBcBAAAAKAAAAAIBAAAQABEAAAAAAAEAA//8AQAAAAVhcHBsZQ== -\'/*!*/; +BINLOG 'fAS3SBMBAAAALAAAANoAAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= +fAS3SBcBAAAAKAAAAAIBAAAQABEAAAAAAAEAA//8AQAAAAVhcHBsZQ=='/*!*/; ### INSERT INTO test\&.t ### SET ### @1=1 -### @2=\'apple\' +### @2='apple' ### @3=NULL \&.\&.\&. # at 302 #080828 15:03:08 server id 1 end_log_pos 356 Update_rows: table id 17 flags: STMT_END_F -BINLOG \' -fAS3SBMBAAAALAAAAC4BAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= -fAS3SBgBAAAANgAAAGQBAAAQABEAAAAAAAEAA////AEAAAAFYXBwbGX4AQAAAARwZWFyIbIP -\'/*!*/; +BINLOG 'fAS3SBMBAAAALAAAAC4BAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= +fAS3SBgBAAAANgAAAGQBAAAQABEAAAAAAAEAA////AEAAAAFYXBwbGX4AQAAAARwZWFyIbIP'/*!*/; ### UPDATE test\&.t ### WHERE ### @1=1 -### @2=\'apple\' +### @2='apple' ### @3=NULL ### SET ### @1=1 -### @2=\'pear\' -### @3=\'2009:01:01\' +### @2='pear' +### @3='2009:01:01' \&.\&.\&. # at 400 #080828 15:03:08 server id 1 end_log_pos 442 Delete_rows: table id 17 flags: STMT_END_F -BINLOG \' -fAS3SBMBAAAALAAAAJABAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= -fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP -\'/*!*/; +BINLOG 'fAS3SBMBAAAALAAAAJABAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= +fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP'/*!*/; ### DELETE FROM test\&.t ### WHERE ### @1=1 -### @2=\'pear\' -### @3=\'2009:01:01\' +### @2='pear' +### @3='2009:01:01' .fi .if n \{\ .RE @@ -1915,43 +1893,37 @@ shell> \fBmysqlbinlog \-vv \fR\fB\fIlog_file\fR\fR \&.\&.\&. # at 218 #080828 15:03:08 server id 1 end_log_pos 258 Write_rows: table id 17 flags: STMT_END_F -BINLOG \' -fAS3SBMBAAAALAAAANoAAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= -fAS3SBcBAAAAKAAAAAIBAAAQABEAAAAAAAEAA//8AQAAAAVhcHBsZQ== -\'/*!*/; +BINLOG 'fAS3SBMBAAAALAAAANoAAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= +fAS3SBcBAAAAKAAAAAIBAAAQABEAAAAAAAEAA//8AQAAAAVhcHBsZQ=='/*!*/; ### INSERT INTO test\&.t ### SET ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ -### @2=\'apple\' /* VARSTRING(20) meta=20 nullable=0 is_null=0 */ +### @2='apple' /* VARSTRING(20) meta=20 nullable=0 is_null=0 */ ### @3=NULL /* VARSTRING(20) meta=0 nullable=1 is_null=1 */ \&.\&.\&. # at 302 #080828 15:03:08 server id 1 end_log_pos 356 Update_rows: table id 17 flags: STMT_END_F -BINLOG \' -fAS3SBMBAAAALAAAAC4BAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= -fAS3SBgBAAAANgAAAGQBAAAQABEAAAAAAAEAA////AEAAAAFYXBwbGX4AQAAAARwZWFyIbIP -\'/*!*/; +BINLOG 'fAS3SBMBAAAALAAAAC4BAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= +fAS3SBgBAAAANgAAAGQBAAAQABEAAAAAAAEAA////AEAAAAFYXBwbGX4AQAAAARwZWFyIbIP'/*!*/; ### UPDATE test\&.t ### WHERE ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ -### @2=\'apple\' /* VARSTRING(20) meta=20 nullable=0 is_null=0 */ +### @2='apple' /* VARSTRING(20) meta=20 nullable=0 is_null=0 */ ### @3=NULL /* VARSTRING(20) meta=0 nullable=1 is_null=1 */ ### SET ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ -### @2=\'pear\' /* VARSTRING(20) meta=20 nullable=0 is_null=0 */ -### @3=\'2009:01:01\' /* DATE meta=0 nullable=1 is_null=0 */ +### @2='pear' /* VARSTRING(20) meta=20 nullable=0 is_null=0 */ +### @3='2009:01:01' /* DATE meta=0 nullable=1 is_null=0 */ \&.\&.\&. # at 400 #080828 15:03:08 server id 1 end_log_pos 442 Delete_rows: table id 17 flags: STMT_END_F -BINLOG \' -fAS3SBMBAAAALAAAAJABAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= -fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP -\'/*!*/; +BINLOG 'fAS3SBMBAAAALAAAAJABAAAAABEAAAAAAAAABHRlc3QAAXQAAwMPCgIUAAQ= +fAS3SBkBAAAAKgAAALoBAAAQABEAAAAAAAEAA//4AQAAAARwZWFyIbIP'/*!*/; ### DELETE FROM test\&.t ### WHERE ### @1=1 /* INT meta=0 nullable=0 is_null=0 */ -### @2=\'pear\' /* VARSTRING(20) meta=20 nullable=0 is_null=0 */ -### @3=\'2009:01:01\' /* DATE meta=0 nullable=1 is_null=0 */ +### @2='pear' /* VARSTRING(20) meta=20 nullable=0 is_null=0 */ +### @3='2009:01:01' /* DATE meta=0 nullable=1 is_null=0 */ .fi .if n \{\ .RE @@ -1982,7 +1954,7 @@ shell> \fBmysqlbinlog \-v \-\-base64\-output=DECODE\-ROWS \fR\fB\fIlog_file\fR\f ### INSERT INTO test\&.t ### SET ### @1=1 -### @2=\'apple\' +### @2='apple' ### @3=NULL \&.\&.\&. # at 302 @@ -1990,20 +1962,20 @@ shell> \fBmysqlbinlog \-v \-\-base64\-output=DECODE\-ROWS \fR\fB\fIlog_file\fR\f ### UPDATE test\&.t ### WHERE ### @1=1 -### @2=\'apple\' +### @2='apple' ### @3=NULL ### SET ### @1=1 -### @2=\'pear\' -### @3=\'2009:01:01\' +### @2='pear' +### @3='2009:01:01' \&.\&.\&. # at 400 #080828 15:03:08 server id 1 end_log_pos 442 Delete_rows: table id 17 flags: STMT_END_F ### DELETE FROM test\&.t ### WHERE ### @1=1 -### @2=\'pear\' -### @3=\'2009:01:01\' +### @2='pear' +### @3='2009:01:01' .fi .if n \{\ .RE diff --git a/man/mariadb-check.1 b/man/mariadb-check.1 index ae9937db4d3..6191e933442 100644 --- a/man/mariadb-check.1 +++ b/man/mariadb-check.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-CHECK\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-CHECK\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -79,7 +79,7 @@ table, an attempt to check it produces this result: .nf shell> \fBmysqlcheck test t\fR test\&.t -note : The storage engine for the table doesn\'t support check +note : The storage engine for the table doesn't support check .fi .if n \{\ .RE @@ -179,7 +179,7 @@ supports the following options, which can be specified on the command line or in and [client] option file groups\&. -The \fB-c\fR, \fB-r\fR, \fB-a\fR and \fB-o\fR options are exclusive to each other\&. +The \fB-c\fR, \fB-r\fR, \fB-a\fR and \fB-o\fR options are exclusive to each other\&. .sp .RS 4 .ie n \{\ @@ -381,9 +381,7 @@ treats the first name argument on the command line as a database name and follow .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is -\'d:t:o,\fIfile_name\fR\'\&. The default is -\'d:t:o\'\&. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o'. .RE .sp .RS 4 @@ -495,7 +493,7 @@ Must be given as first option\&. .sp If you are using this option to check tables, it ensures that they are 100% consistent but takes a long time\&. .sp -If you are using this option to repair tables, it will force using the old, slow, repair with keycache method, +If you are using this option to repair tables, it will force using the old, slow, repair with keycache method, instead of the much faster repair by sorting. .RE .sp @@ -890,7 +888,7 @@ Forces --protocol=socket when specified on the command line without other connec .\" SSL options: mysqladmin \fB\-\-ssl\fR .sp -Enable SSL for connection (automatically enabled with other flags). Disable with +Enable SSL for connection (automatically enabled with other flags). Disable with \fB\-\-skip-ssl\fR\&. .RE .sp @@ -1091,7 +1089,7 @@ The MariaDB user name to use when connecting to the server\&. \fB\-v\fR .sp Verbose mode\&. Print information about the various stages of program operation\&. -Using one \fB--verbose\fR option will give you more information about what mysqlcheck is +Using one \fB--verbose\fR option will give you more information about what mysqlcheck is doing\&. .sp Using two \fB--verbose\fR options will also give you connection information\&. diff --git a/man/mariadb-client-test.1 b/man/mariadb-client-test.1 index 9d23903768c..2866dfa5029 100644 --- a/man/mariadb-client-test.1 +++ b/man/mariadb-client-test.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-CLIENT-TEST" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-CLIENT-TEST\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -123,8 +123,7 @@ The database to use\&. .sp Write a debugging log if MariaDB is built with debugging support\&. The default \fIdebug_options\fR -value is -\'d:t:o,/tmp/mysql_client_test\&.trace\'\&. +value is 'd:t:o,/tmp/mysql_client_test.trace'. .RE .sp .RS 4 diff --git a/man/mariadb-conv.1 b/man/mariadb-conv.1 index c47e08c99a7..487ad003aec 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\&.10" "MariaDB Database System" +.TH "\fBMARIADB-CONV\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-convert-table-format.1 b/man/mariadb-convert-table-format.1 index e1deb7df54d..89f6f37bcf9 100644 --- a/man/mariadb-convert-table-format.1 +++ b/man/mariadb-convert-table-format.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-CONVERT-TAB" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-CONVERT-TABLE-FORMAT\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-dump.1 b/man/mariadb-dump.1 index 9bb6fdadca1..06ffd651c6c 100644 --- a/man/mariadb-dump.1 +++ b/man/mariadb-dump.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-DUMP\FR" "1" "24 October 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-DUMP\fR" "1" "24 October 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -63,7 +63,7 @@ option, entire databases are dumped\&. \fBmysqldump\fR does not dump the INFORMATION_SCHEMA or performance_schema -databases by default\&. To dump these, +databases by default\&. To dump these, name them explicitly on the command line, although you must also use the \fB\-\-skip\-lock\-tables\fR option\&. @@ -504,7 +504,7 @@ Compress all information sent between the client and the server if both support .\" copy-s3-tables option: mysqldump \fB\-\-copy\-s3\-tables\fR .sp -By default S3 tables are ignored\&. With this option set, the result file will contain a CREATE statement +By default S3 tables are ignored\&. With this option set, the result file will contain a CREATE statement for a similar Aria table, followed by the table data and ending with an ALTER TABLE xxx ENGINE=S3\&. .RE .sp @@ -563,9 +563,7 @@ statements are included in the output before each new database\&. .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is -\'d:t:o,\fIfile_name\fR\'\&. The default value is -\'d:t:o,/tmp/mysqldump\&.trace\'\&. +string is 'd:t:o,\fIfile_name\fR'. The default value is 'd:t:o,/tmp/mysqldump.trace'. .RE .sp .RS 4 @@ -793,14 +791,14 @@ suppresses date printing\& .\" dump-slave option: mysqldump \fB\-\-dump\-slave[=\fR\fB\fIvalue\fR\fR\fB]\fR .sp -Used for producing a dump file from a replication slave server that can be used to set up another slave server -with the same master\&. Causes the binary log position and filename of the master to be appended to the dumped -data output\&. Setting the value to 1 (the default) will print it as a CHANGE MASTER command in the dumped data -output; if set to 2, that command will be prefixed with a comment symbol\&. This option will turn -\-\-lock\-all\-tables on, unless \-\-single-transaction is specified too (in which case a global read lock is only -taken a short time at the beginning of the dump \- don't forget to read about \-\-single-transaction below)\&. In -all cases any action on logs will happen at the exact moment of the dump\&. Option automatically turns -\-\-lock\-tables off\&. Using this option causes mysqldump to stop the slave SQL thread before beginning the dump, +Used for producing a dump file from a replication slave server that can be used to set up another slave server +with the same master\&. Causes the binary log position and filename of the master to be appended to the dumped +data output\&. Setting the value to 1 (the default) will print it as a CHANGE MASTER command in the dumped data +output; if set to 2, that command will be prefixed with a comment symbol\&. This option will turn +\-\-lock\-all\-tables on, unless \-\-single-transaction is specified too (in which case a global read lock is only +taken a short time at the beginning of the dump \- don't forget to read about \-\-single-transaction below)\&. In +all cases any action on logs will happen at the exact moment of the dump\&. Option automatically turns +\-\-lock\-tables off\&. Using this option causes mysqldump to stop the slave SQL thread before beginning the dump, and restart it again after completion\&. .RE .sp @@ -1022,9 +1020,7 @@ Used together with --tab. When enabled, adds header with column names to the top .\" hex-blob option: mysqldump \fB\-\-hex\-blob\fR .sp -Dump binary columns using hexadecimal notation (for example, -\'abc\' -becomes +Dump binary columns using hexadecimal notation (for example, 'abc' becomes 0x616263)\&. The affected data types are BINARY, VARBINARY, the @@ -1077,7 +1073,7 @@ Do not dump the given table, which must be specified using both the database and .\" include-master-host-port option: mysqldump \fB\-\-include\-master\-host\-port\fR .sp -Add the MASTER_HOST and MASTER_PORT options for the CHANGE MASTER TO statement when using +Add the MASTER_HOST and MASTER_PORT options for the CHANGE MASTER TO statement when using the \fB--dump-slave\fR option for a slave dump\&. .RE .sp @@ -1197,7 +1193,7 @@ Log warnings and errors by appending them to the named file\&. The default is to .\" log-queries option: mysqldump \fB\-\-log\-queries\fR\fR .sp -When restoring the dump, the server will, if logging is turned on, log the queries to the general and slow query log\&. +When restoring the dump, the server will, if logging is turned on, log the queries to the general and slow query log\&. Defaults to on; use \fB--skip-log-queries\fR to disable\&. .RE .sp @@ -1243,7 +1239,7 @@ It is also possible to set up a slave by dumping an existing slave of the master .sp -1 .IP " 1." 4.2 .\} -Stop the slave\'s SQL thread and get its current status: +Stop the slave's SQL thread and get its current status: .sp .if n \{\ .RS 4 @@ -1355,7 +1351,7 @@ On the new slave, set the replication coordinates to those of the master server .\} .nf mysql> \fBCHANGE MASTER TO\fR - \-> \fBMASTER_LOG_FILE = \'\fR\fB\fIfile_name\fR\fR\fB\', MASTER_LOG_POS = \fR\fB\fIfile_pos\fR\fR\fB;\fR + \-> \fBMASTER_LOG_FILE = '\fR\fB\fIfile_name\fR\fR\fB', MASTER_LOG_POS = \fR\fB\fIfile_pos\fR\fR\fB;\fR .fi .if n \{\ .RE @@ -1564,7 +1560,7 @@ See the discussion at the beginning of this section for information about select .\" order-by-primary option: mysqldump \fB\-\-order\-by\-primary\fR .sp -Dump each table\'s rows sorted by its primary key, or by its first unique index, if such an index exists\&. This is useful when dumping a +Dump each table's rows sorted by its primary key, or by its first unique index, if such an index exists\&. This is useful when dumping a MyISAM table to be loaded into an InnoDB @@ -1880,7 +1876,7 @@ option with .\" skip-add-drop-table option: mysqldump \fB\-\-skip\-add\-drop\-table\fR .sp -Disable the +Disable the \fB\-\-add\-drop\-table\fR option\&. .RE @@ -1897,7 +1893,7 @@ option\&. .\" skip-add-locks option: mysqldump \fB\-\-skip\-add\-locks\fR .sp -Disable the +Disable the \fB\-\-add\-locks\fR option\&. .RE @@ -1914,7 +1910,7 @@ option\&. .\" skip-comments option: mysqldump \fB\-\-skip\-comments\fR .sp -Disable the +Disable the \fB\-\-comments\fR option\&. .RE @@ -1931,7 +1927,7 @@ option\&. .\" skip-compact option: mysqldump \fB\-\-skip\-compact\fR .sp -Disable the +Disable the \fB\-\-compact\fR option\&. .RE @@ -1948,7 +1944,7 @@ option\&. .\" skip-disable-keys option: mysqldump \fB\-\-skip\-disable\-keys\fR .sp -Disable the +Disable the \fB\-\-disable\-keys\fR option\&. .RE @@ -1965,7 +1961,7 @@ option\&. .\" skip-extended-insert option: mysqldump \fB\-\-skip\-extended\-insert\fR .sp -Disable the +Disable the \fB\-\-extended\-insert\fR option\&. .RE @@ -1999,7 +1995,7 @@ option\&. .\" skip-quick option: mysqldump \fB\-\-skip\-quick\fR .sp -Disable the +Disable the \fB\-\-quick\fR option\&. .RE @@ -2016,7 +2012,7 @@ option\&. .\" skip-quote-names option: mysqldump \fB\-\-skip\-quote\-names\fR .sp -Disable the +Disable the \fB\-\-quote\-names\fR option\&. .RE @@ -2033,7 +2029,7 @@ option\&. .\" skip-set-charset option: mysqldump \fB\-\-skip\-set\-charset\fR .sp -Disable the +Disable the \fB\-\-set\-charset\fR option\&. .RE @@ -2050,7 +2046,7 @@ option\&. .\" skip-triggers option: mysqldump \fB\-\-skip\-triggers\fR .sp -Disable the +Disable the \fB\-\-triggers\fR option\&. .RE @@ -2067,7 +2063,7 @@ option\&. .\" skip-tz-utc option: mysqldump \fB\-\-skip\-tz\-utc\fR .sp -Disable the +Disable the \fB\-\-tz\-utc\fR option\&. .RE @@ -2102,7 +2098,7 @@ Forces --protocol=socket when specified on the command line without other connec .\" SSL options: mysqladmin \fB\-\-ssl\fR .sp -Enable SSL for connection (automatically enabled with other flags). Disable with +Enable SSL for connection (automatically enabled with other flags). Disable with \fB\-\-skip-ssl\fR\&. .RE .sp @@ -2446,7 +2442,7 @@ TIMESTAMP columns to be dumped and reloaded between servers in different time zones\&. \fBmysqldump\fR sets its connection time zone to UTC and adds -SET TIME_ZONE=\'+00:00\' +SET TIME_ZONE='+00:00' to the dump file\&. Without this option, TIMESTAMP columns are dumped and reloaded in the time zones local to the source and destination servers, which can cause the values to change if the servers are in different time zones\&. @@ -2515,8 +2511,8 @@ Display version information and exit\&. .\} .\" mysqldump: where option .\" where option: mysqldump -\fB\-\-where=\'\fR\fB\fIwhere_condition\fR\fR\fB\'\fR, -\fB\-w \'\fR\fB\fIwhere_condition\fR\fR\fB\'\fR +\fB\-\-where='\fR\fB\fIwhere_condition\fR\fR\fB'\fR, +\fB\-w '\fR\fB\fIwhere_condition\fR\fR\fB'\fR .sp Dump only rows selected by the given WHERE @@ -2528,7 +2524,7 @@ Examples: .RS 4 .\} .nf -\-\-where="user=\'jimf\'" +\-\-where="user='jimf'" \-w"userid>1" \-w"userid<1" .fi @@ -2552,11 +2548,8 @@ Examples: .sp Write dump output as well\-formed XML\&. .sp -\fBNULL\fR\fB, \fR\fB\'NULL\'\fR\fB, and Empty Values\fR: For a column named -\fIcolumn_name\fR, the -NULL -value, an empty string, and the string value -\'NULL\' +\fBNULL\fR\fB, \fR\fB'NULL'\fR\fB, and Empty Values\fR: For a column named +\fIcolumn_name\fR, the NULL value, an empty string, and the string value 'NULL' are distinguished from one another in the output generated by this option as follows\&. .TS allbox tab(:); @@ -2572,12 +2565,12 @@ T}:T{ T} T{ -\'\' (\fIempty string\fR) +\(aq\(aq (\fIempty string\fR) T}:T{ T} T{ -\'NULL\' (\fIstring value\fR) +\(aqNULL\(aq (\fIstring value\fR) T}:T{ NULL T} diff --git a/man/mariadb-dumpslow.1 b/man/mariadb-dumpslow.1 index 4f82544dc14..960c634dded 100644 --- a/man/mariadb-dumpslow.1 +++ b/man/mariadb-dumpslow.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-DUMPSLOW\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-DUMPSLOW\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -27,11 +27,7 @@ Normally, \fBmysqldumpslow\fR groups queries that are similar except for the particular values of number and string data values\&. It \(lqabstracts\(rq -these values to -N -and -\'S\' -when displaying summary output\&. The +these values to N and 'S' when displaying summary output\&. The \fB\-a\fR and \fB\-n\fR @@ -79,10 +75,7 @@ Display a help message and exit\&. .\} \fB\-a\fR .sp -Do not abstract all numbers to -N -and strings to -\'S\'\&. +Do not abstract all numbers to N and strings to 'S'. .RE .sp .RS 4 diff --git a/man/mariadb-find-rows.1 b/man/mariadb-find-rows.1 index f0220250bf7..c80490c23f0 100644 --- a/man/mariadb-find-rows.1 +++ b/man/mariadb-find-rows.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-FIND-ROWS\F" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-FIND-ROWS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-fix-extensions.1 b/man/mariadb-fix-extensions.1 index b7bec412b36..2313b9f6586 100644 --- a/man/mariadb-fix-extensions.1 +++ b/man/mariadb-fix-extensions.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-FIX-EXTENSI" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-FIX-EXTENSIONS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-hotcopy.1 b/man/mariadb-hotcopy.1 index 9e545c784c0..01f26c15ab5 100644 --- a/man/mariadb-hotcopy.1 +++ b/man/mariadb-hotcopy.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-HOTCOPY\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-HOTCOPY\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-import.1 b/man/mariadb-import.1 index bc84ed54179..99578950ad3 100644 --- a/man/mariadb-import.1 +++ b/man/mariadb-import.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-IMPORT\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-IMPORT\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -49,7 +49,7 @@ shell> \fBmysqlimport [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB \fR\ .PP For each text file named on the command line, \fBmysqlimport\fR -strips any extension from the file name and uses the result to determine the name of the table into which to import the file\'s contents\&. For example, files named +strips any extension from the file name and uses the result to determine the name of the table into which to import the file's contents\&. For example, files named patient\&.txt, patient\&.text, and patient @@ -144,9 +144,7 @@ Compress all information sent between the client and the server if both support .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is -\'d:t:o,\fIfile_name\fR\'\&. The default is -\'d:t:o\'\&. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o'. .RE .sp .RS 4 @@ -633,7 +631,7 @@ Forces --protocol=socket when specified on the command line without other connec .\" SSL options: mysqladmin \fB\-\-ssl\fR .sp -Enable SSL for connection (automatically enabled with other flags). Disable with +Enable SSL for connection (automatically enabled with other flags). Disable with \fB\-\-skip-ssl\fR\&. .RE .sp @@ -836,7 +834,7 @@ Here is a sample session that demonstrates use of .RS 4 .\} .nf -shell> \fBmysql \-e \'CREATE TABLE imptest(id INT, n VARCHAR(30))\' test\fR +shell> \fBmysql \-e 'CREATE TABLE imptest(id INT, n VARCHAR(30))' test\fR shell> \fBed\fR a 100 Max Sydow @@ -851,7 +849,7 @@ shell> \fBod \-c imptest\&.txt\fR 0000040 shell> \fBmysqlimport \-\-local test imptest\&.txt\fR test\&.imptest: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 -shell> \fBmysql \-e \'SELECT * FROM imptest\' test\fR +shell> \fBmysql \-e 'SELECT * FROM imptest' test\fR +\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | id | n | +\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ diff --git a/man/mariadb-install-db.1 b/man/mariadb-install-db.1 index 1046a77c7e0..f945c259748 100644 --- a/man/mariadb-install-db.1 +++ b/man/mariadb-install-db.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-INSTALL-DB\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-INSTALL-DB\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-plugin.1 b/man/mariadb-plugin.1 index d01fd26634c..0512bb50ed2 100644 --- a/man/mariadb-plugin.1 +++ b/man/mariadb-plugin.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-PLUGIN\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-PLUGIN\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/man/mariadb-secure-installation.1 b/man/mariadb-secure-installation.1 index 9c788238d9c..0d30ee24087 100644 --- a/man/mariadb-secure-installation.1 +++ b/man/mariadb-secure-installation.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-SECURE-INST" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-SECURE-INSTALLATION\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-service-convert.1 b/man/mariadb-service-convert.1 index 6694145e491..258c1793b41 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\&.10" "MariaDB Database System" +.TH "\fBMARIADB-SERVICE-CONVERT\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-setpermission.1 b/man/mariadb-setpermission.1 index 1510981ddeb..7725ad69828 100644 --- a/man/mariadb-setpermission.1 +++ b/man/mariadb-setpermission.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-SETPERMISSI" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-SETPERMISSION\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-show.1 b/man/mariadb-show.1 index dd0f97ed407..85b20a971fb 100644 --- a/man/mariadb-show.1 +++ b/man/mariadb-show.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-SHOW\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-SHOW\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -26,7 +26,7 @@ mariadb-show \- display database, table, and column information (mysqlshow is no .PP The \fBmysqlshow\fR -client can be used to quickly see which databases exist, their tables, or a table\'s columns or indexes\&. +client can be used to quickly see which databases exist, their tables, or a table's columns or indexes\&. .PP \fBmysqlshow\fR provides a command\-line interface to several SQL @@ -191,9 +191,7 @@ tables\&. .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is -\'d:t:o,\fIfile_name\fR\'\&. The default is -\'d:t:o\'\&. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o'. .RE .sp .RS 4 @@ -510,7 +508,7 @@ Forces --protocol=socket when specified on the command line without other connec .\" SSL options: mysqlshow \fB\-\-ssl\fR .sp -Enable SSL for connection (automatically enabled with other flags). Disable with +Enable SSL for connection (automatically enabled with other flags). Disable with \fB\-\-skip-ssl\fR\&. .RE .sp diff --git a/man/mariadb-slap.1 b/man/mariadb-slap.1 index f14ab8fa3fa..dbb458cea36 100644 --- a/man/mariadb-slap.1 +++ b/man/mariadb-slap.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-SLAP\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-SLAP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -105,7 +105,7 @@ build the query SQL statement with a table of two INT columns and three VARCHAR -columns\&. Use five clients querying 20 times each\&. Do not create the table or insert the data (that is, use the previous test\'s schema and data): +columns\&. Use five clients querying 20 times each\&. Do not create the table or insert the data (that is, use the previous test's schema and data): .sp .if n \{\ .RS 4 @@ -119,15 +119,11 @@ mysqlslap \-\-concurrency=5 \-\-iterations=20 \e .RE .\} .PP -Tell the program to load the create, insert, and query SQL statements from the specified files, where the -create\&.sql -file has multiple table creation statements delimited by -\';\' -and multiple insert statements delimited by -\';\'\&. The +Tell the program to load the create, insert, and query SQL statements from the specified files, where the create\&.sql +file has multiple table creation statements delimited by ';' and multiple insert statements delimited by ';'\&. The \fB\-\-query\fR -file will have multiple queries delimited by -\';\'\&. Run all the load statements, then run all the queries in the query file with five clients (five times each): +file will have multiple queries delimited by ';'\&. Run all the load statements, +then run all the queries in the query file with five clients (five times each): .sp .if n \{\ .RS 4 @@ -427,9 +423,7 @@ Generate output in comma\-separated values format\&. The output goes to the name .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is -\'d:t:o,\fIfile_name\fR\'\&. The default is -\'d:t:o,/tmp/mysqlslap\&.trace\'\&. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysqlslap.trace'. .RE .sp .RS 4 @@ -556,7 +550,7 @@ statements\&. The default is 0 (connections are not detached)\&. \fB\-\-engine=\fR\fB\fIengine_name\fR\fR, \fB\-e \fR\fB\fIengine_name\fR\fR .sp -Comma separated list of storage engines to use for creating the table\&. The test is run for +Comma separated list of storage engines to use for creating the table\&. The test is run for each engine\&. You can also specify an option for an engine after a colon, for example \fBmemory:max_row=2300\fR\&. .RE @@ -976,7 +970,7 @@ Forces --protocol=socket when specified on the command line without other connec .\" SSL options: mysqlshow \fB\-\-ssl\fR .sp -Enable SSL for connection (automatically enabled with other flags). Disable with +Enable SSL for connection (automatically enabled with other flags). Disable with \fB\-\-skip-ssl\fR\&. .RE .sp diff --git a/man/mariadb-test.1 b/man/mariadb-test.1 index 0f1e138a448..b1326ba8dbe 100644 --- a/man/mariadb-test.1 +++ b/man/mariadb-test.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-TEST\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-TEST\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -218,9 +218,9 @@ This can be used to set the MYSQL_OPT_CONNECT_TIMEOUT parameter of mysql_options .\" continue-on-error option: mysqltest \fB\-\-continue\-on\-error\fR .sp -Continue test even if we got an error\&. This is mostly -useful when testing a storage engine to see what from a -test file it can execute, or to find all syntax errors in +Continue test even if we got an error\&. This is mostly +useful when testing a storage engine to see what from a +test file it can execute, or to find all syntax errors in a newly created big test file\&. .RE .sp @@ -270,8 +270,7 @@ The default database to use\&. .sp Write a debugging log if MariaDB is built with debugging support\&. The default \fIdebug_options\fR -value is -\'d:t:S:i:O,/tmp/mysqltest\&.trace\'\&. +value is 'd:t:S:i:O,/tmp/mysqltest.trace'. .RE .sp .RS 4 @@ -478,7 +477,7 @@ Directory for client-side plugins\&. \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp -The TCP/IP port number to use for the connection or 0 for default to, in order of preference, +The TCP/IP port number to use for the connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306)\&. .RE .sp @@ -792,7 +791,7 @@ creates and invokes a stored procedure that executes the statement rather than e .\" SSL options: mysqltest \fB\-\-ssl\fR .sp -Enable SSL for connection (automatically enabled with other flags). Disable with +Enable SSL for connection (automatically enabled with other flags). Disable with \fB\-\-skip-ssl\fR\&. .RE .sp diff --git a/man/mariadb-tzinfo-to-sql.1 b/man/mariadb-tzinfo-to-sql.1 index 08681335c47..e287db0c9ce 100644 --- a/man/mariadb-tzinfo-to-sql.1 +++ b/man/mariadb-tzinfo-to-sql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-TZINFO-TO-S" "1" "22 April 2022" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-TZINFO-TO-SQL\fR" "1" "22 April 2022" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -64,7 +64,7 @@ shell> \fBmysql_tzinfo_to_sql /usr/share/zoneinfo | mysql \-u root mysql\fR .\} .PP \fBmysql_tzinfo_to_sql\fR -reads your system\'s time zone files and generates SQL statements from them\&. +reads your system's time zone files and generates SQL statements from them\&. \fBmysql\fR processes those statements to load the time zone tables\&. .PP diff --git a/man/mariadb-upgrade.1 b/man/mariadb-upgrade.1 index 198efcac747..8532003a2b8 100644 --- a/man/mariadb-upgrade.1 +++ b/man/mariadb-upgrade.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-UPGRADE\FR" "1" "20 July 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-UPGRADE\fR" "1" "20 July 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb-waitpid.1 b/man/mariadb-waitpid.1 index 9153d246a03..268518d5b98 100644 --- a/man/mariadb-waitpid.1 +++ b/man/mariadb-waitpid.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB-WAITPID\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB-WAITPID\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadb.1 b/man/mariadb.1 index dd62e92e879..fec2b5c3724 100644 --- a/man/mariadb.1 +++ b/man/mariadb.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADB\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADB\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -340,9 +340,7 @@ The database to use\&. .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is -\'d:t:o,\fIfile_name\fR\'\&. The default is -\'d:t:o,/tmp/mysql\&.trace\'\&. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/mysql.trace'. .RE .sp .RS 4 @@ -884,7 +882,7 @@ Directory for client-side plugins\&. \fB\-\-port=\fR\fB\fIport_num\fR\fR, \fB\-P \fR\fB\fIport_num\fR\fR .sp -The TCP/IP port number to use for the connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306)\&. +The TCP/IP port number to use for the connection or 0 for default to, in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306)\&. Forces --protocol=tcp when specified on the command line without other connection properties\&. .RE .sp @@ -1238,7 +1236,7 @@ Forces --protocol=socket when specified on the command line without other connec .\" SSL options: mysql \fB\-\-ssl\fR .sp -Enable SSL for connection (automatically enabled with other flags). Disable with +Enable SSL for connection (automatically enabled with other flags). Disable with \fB\-\-skip-ssl\fR\&. .RE .sp @@ -1529,9 +1527,9 @@ The XML output also uses an XML namespace, as shown here: .RS 4 .\} .nf -shell> \fBmysql \-\-xml \-uroot \-e "SHOW VARIABLES LIKE \'version%\'"\fR +shell> \fBmysql \-\-xml \-uroot \-e "SHOW VARIABLES LIKE 'version%'"\fR - + version 5\&.0\&.40\-debug @@ -1666,7 +1664,7 @@ if it exists, and then use either of the following techniques: Set the MARIADB_HISTFILE variable to -/dev/null\&. To cause this setting to take effect each time you log in, put the setting in one of your shell\'s startup files\&. +/dev/null\&. To cause this setting to take effect each time you log in, put the setting in one of your shell's startup files\&. .RE .sp .RS 4 @@ -1714,8 +1712,8 @@ prompt: .nf mysql> \fBhelp\fR List of all MySQL commands: -Note that all text commands must be first on line and end with \';\' -? (\e?) Synonym for `help\'\&. +Note that all text commands must be first on line and end with ';' +? (\e?) Synonym for 'help'\&. clear (\ec) Clear command\&. connect (\er) Reconnect to the server\&. Optional arguments are db and host\&. delimiter (\ed) Set statement delimiter\&. @@ -1725,7 +1723,7 @@ exit (\eq) Exit mysql\&. Same as quit\&. go (\eg) Send command to mysql server\&. help (\eh) Display this help\&. nopager (\en) Disable pager, print to stdout\&. -notee (\et) Don\'t write into outfile\&. +notee (\et) Don't write into outfile\&. pager (\eP) Set PAGER [to_pager]\&. Print the query results via PAGER\&. print (\ep) Print current command\&. prompt (\eR) Change your mysql prompt\&. @@ -1740,8 +1738,8 @@ use (\eu) Use another database\&. Takes database name as argument\&. charset (\eC) Switch to another charset\&. Might be needed for processing binlog with multi\-byte charsets\&. warnings (\eW) Show warnings after every statement\&. -nowarning (\ew) Don\'t show warnings after every statement\&. -For server side help, type \'help contents\' +nowarning (\ew) Don't show warnings after every statement\&. +For server side help, type 'help contents' .fi .if n \{\ .RE @@ -1849,7 +1847,7 @@ Change the string that \fBmysql\fR interprets as the separator between SQL statements\&. The default is the semicolon character (\(lq;\(rq)\&. .sp -The delimiter can be specified as an unquoted or quoted argument\&. Quoting can be done with either single quote (\') or douple quote (") characters\&. To include a quote within a quoted string, either quote the string with the other quote character or escape the quote with a backslash (\(lq\e\(rq) character\&. Backslash should be avoided outside of quoted strings because it is the escape character for MariaDB\&. For an unquoted argument, the delmiter is read up to the first space or end of line\&. For a quoted argument, the delimiter is read up to the matching quote on the line\&. +The delimiter can be specified as an unquoted or quoted argument\&. Quoting can be done with either single quote (') or douple quote (") characters\&. To include a quote within a quoted string, either quote the string with the other quote character or escape the quote with a backslash (\(lq\e\(rq) character\&. Backslash should be avoided outside of quoted strings because it is the escape character for MariaDB\&. For an unquoted argument, the delmiter is read up to the first space or end of line\&. For a quoted argument, the delimiter is read up to the matching quote on the line\&. .sp When the delimiter recognized by \fBmysql\fR @@ -2557,7 +2555,7 @@ T}:T{ A space (a space follows the backslash) T} T{ -\e\' +\e' T}:T{ Single quote T} @@ -2703,7 +2701,7 @@ prompt .\} .nf mysql> \fBprompt (\eu@\eh) [\ed]>\e_\fR -PROMPT set to \'(\eu@\eh) [\ed]>\e_\' +PROMPT set to '(\eu@\eh) [\ed]>\e_' (\fIuser\fR@\fIhost\fR) [\fIdatabase\fR]> (\fIuser\fR@\fIhost\fR) [\fIdatabase\fR]> prompt Returning to default PROMPT of mysql> @@ -2741,7 +2739,7 @@ If there is no match for the search string, the search fails: .nf mysql> \fBhelp me\fR Nothing found -Please try to run \'help contents\' for a list of all accessible topics +Please try to run 'help contents' for a list of all accessible topics .fi .if n \{\ .RE @@ -2757,7 +2755,7 @@ to see a list of the help categories: .nf mysql> \fBhelp contents\fR You asked for help about help category: "Contents" -For more information, type \'help \', where is one of the +For more information, type 'help ', where is one of the following categories: Account Management Administration @@ -2789,7 +2787,7 @@ shows a list of matching topics: .nf mysql> \fBhelp logs\fR Many help items for your request exist\&. -To make a more specific request, please type \'help \', +To make a more specific request, please type 'help ', where is one of the following topics: SHOW SHOW BINARY LOGS @@ -2807,7 +2805,7 @@ Use a topic as the search string to see the help entry for that topic: .\} .nf mysql> \fBhelp show binary logs\fR -Name: \'SHOW BINARY LOGS\' +Name: 'SHOW BINARY LOGS' Description: Syntax: SHOW BINARY LOGS @@ -2907,7 +2905,7 @@ Sometimes you may want your script to display progress information to the user\& .RS 4 .\} .nf -SELECT \'\' AS \' \'; +SELECT '' AS ' '; .fi .if n \{\ .RE @@ -2954,7 +2952,7 @@ mail_from: Monty sbj: UTF\-8 txt: >>>>> "Thimble" == Thimble Smith writes: Thimble> Hi\&. I think this is a good idea\&. Is anyone familiar -Thimble> with UTF\-8 or Unicode? Otherwise, I\'ll put this on my +Thimble> with UTF\-8 or Unicode? Otherwise, I'll put this on my Thimble> TODO list and see what happens\&. Yes, please do that\&. Regards, diff --git a/man/mariadb_config.1 b/man/mariadb_config.1 index 334478ce32c..941e372864b 100644 --- a/man/mariadb_config.1 +++ b/man/mariadb_config.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_CONFIG\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMYSQL_CONFIG\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadbd-multi.1 b/man/mariadbd-multi.1 index 76d1c97d206..e51e3875613 100644 --- a/man/mariadbd-multi.1 +++ b/man/mariadbd-multi.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADBD-MULTI\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADBD-MULTI\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -368,8 +368,8 @@ Silent mode; disable warnings\&. .\" tcp-ip option: mysqld_multi \fB\-\-tcp\-ip\fR .sp -Connect to the MariaDB server(s) via the TCP/IP port instead of the UNIX socket\&. This affects stopping -and reporting. If a socket file is missing, the server may still be running, but can be accessed only +Connect to the MariaDB server(s) via the TCP/IP port instead of the UNIX socket\&. This affects stopping +and reporting. If a socket file is missing, the server may still be running, but can be accessed only via the TCP/IP port\&. By default connecting is done via the UNIX socket\&. This option affects stop and report operations\&. .RE @@ -511,7 +511,7 @@ account by executing the following commands for each server: shell> \fBmysql \-u root \-S /tmp/mysql\&.sock \-p\fR Enter password: mysql> \fBGRANT SHUTDOWN ON *\&.*\fR - \-> \fBTO \'multi_admin\'@\'localhost\' IDENTIFIED BY \'multipass\';\fR + \-> \fBTO 'multi_admin'@'localhost' IDENTIFIED BY 'multipass';\fR .fi .if n \{\ .RE @@ -606,7 +606,7 @@ option for \fBmysqld_multi\fR script as the Unix root -user\&. Having the option in the option file doesn\'t matter; you just get a warning if you are not the superuser and the +user\&. Having the option in the option file doesn't matter; you just get a warning if you are not the superuser and the \fBmysqld\fR processes are started under your own Unix account\&. .RE diff --git a/man/mariadbd-safe-helper.1 b/man/mariadbd-safe-helper.1 index e25447e2c11..24bb980c37d 100644 --- a/man/mariadbd-safe-helper.1 +++ b/man/mariadbd-safe-helper.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADBD-SAFE-HELPER\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADBD-SAFE-HELPER\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mariadbd-safe.1 b/man/mariadbd-safe.1 index 2e58df90c69..ffd1d691f97 100644 --- a/man/mariadbd-safe.1 +++ b/man/mariadbd-safe.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADBD-SAFE\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADBD-SAFE\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -327,7 +327,7 @@ directory\&. .sp Use the nice -program to set the server\'s scheduling priority to the given value\&. +program to set the server's scheduling priority to the given value\&. .RE .sp .RS 4 diff --git a/man/mariadbd.8 b/man/mariadbd.8 index aee253fc220..16280234034 100644 --- a/man/mariadbd.8 +++ b/man/mariadbd.8 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMARIADBD\FR" "8" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMARIADBD\fR" "8" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mbstream.1 b/man/mbstream.1 index ed9d0036381..9409d8660e5 100644 --- a/man/mbstream.1 +++ b/man/mbstream.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMBSTREAM\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMBSTREAM\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/msql2mysql.1 b/man/msql2mysql.1 index 4aecf1eb077..ed6c136f395 100644 --- a/man/msql2mysql.1 +++ b/man/msql2mysql.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMSQL2MYSQL\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMSQL2MYSQL\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/my_print_defaults.1 b/man/my_print_defaults.1 index e3d1c7ac06d..d519d89ea67 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\&.10" "MariaDB Database System" +.TH "\fBMY_PRINT_DEFAULTS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -80,8 +80,8 @@ Display a help message and exit\&. \fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR, \fB\-c \fR\fB\fIfile_name\fR\fR .sp -Read only the given option file\&. If no extension is given, default extension(.ini or .cnf) will -be used\&. If \fB\-\-defaults\-file\fR is +Read only the given option file\&. If no extension is given, default extension(.ini or .cnf) will +be used\&. If \fB\-\-defaults\-file\fR is the first option, then read this file only, do not read global or per\-user config files; should be the first option. .RE .sp @@ -100,9 +100,7 @@ the first option, then read this file only, do not read global or per\-user conf .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is -\'d:t:o,\fIfile_name\fR\'\&. The default is -\'d:t:o,/tmp/my_print_defaults\&.trace\'\&. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/my_print_defaults.trace'. .RE .sp .RS 4 @@ -120,7 +118,7 @@ string is .\" extra-file option: my_print_defaults \fB\-e \fR\fB\fIfile_name\fR\fR .sp -Read this option file after the global option file but (on Unix) before the user option +Read this option file after the global option file but (on Unix) before the user option file\&. Should be the first option\&. .RE .sp diff --git a/man/my_safe_process.1 b/man/my_safe_process.1 index faa81190b0a..455e1b8860f 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\&.10" "MariaDB Database System" +.TH "\fBMY_SAFE_PROCESS\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisam_ftdump.1 b/man/myisam_ftdump.1 index a14722f3625..449ff55d37a 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\&.10" "MariaDB Database System" +.TH "\fBMYISAM_FTDUMP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -56,7 +56,7 @@ table\&. You can also specify a table by naming its index file (the file with th \&.MYI suffix)\&. If you do not invoke \fBmyisam_ftdump\fR -in the directory where the table files are located, the table or index file name must be preceded by the path name to the table\'s database directory\&. Index numbers begin with 0\&. +in the directory where the table files are located, the table or index file name must be preceded by the path name to the table's database directory\&. Index numbers begin with 0\&. .PP Example: Suppose that the test diff --git a/man/myisamchk.1 b/man/myisamchk.1 index a6a274ed2be..dae679bd4d5 100644 --- a/man/myisamchk.1 +++ b/man/myisamchk.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYISAMCHK\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMYISAMCHK\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -189,7 +189,7 @@ Otherwise, when you run .RS 4 .\} .nf -warning: clients are using or haven\'t closed the table properly +warning: clients are using or haven't closed the table properly .fi .if n \{\ .RE @@ -197,7 +197,7 @@ warning: clients are using or haven\'t closed the table properly .PP This means that you are trying to check a table that has been updated by another program (such as the \fBmysqld\fR -server) that hasn\'t yet closed the file or that has died without closing the file properly, which can sometimes lead to the corruption of one or more +server) that hasn't yet closed the file or that has died without closing the file properly, which can sometimes lead to the corruption of one or more MyISAM tables\&. .PP @@ -273,9 +273,7 @@ Display a help message and exit\&. Options are presented in a single list\&. .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is -\'d:t:o,\fIfile_name\fR\'\&. The default is -\'d:t:o,/tmp/myisamchk\&.trace\'\&. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o,/tmp/myisamchk.trace'. .RE .sp .RS 4 @@ -729,7 +727,7 @@ the section called \(lqMYISAMCHK TABLE INFORMATION\(rq\&. \fB\-\-fast\fR, \fB\-F\fR .sp -Check only tables that haven\'t been closed properly\&. +Check only tables that haven't been closed properly\&. .RE .sp .RS 4 @@ -751,7 +749,7 @@ finds any errors in the table\&. The repair type is the same as that specified w \fB\-\-recover\fR or \fB\-r\fR -option\&. States will be updated as with +option\&. States will be updated as with \fB\-\-update\-state\fR\&. .RE .sp @@ -826,7 +824,7 @@ Store information in the \&.MYI file to indicate when the table was checked and whether the table crashed\&. This should be used to get full benefit of the \fB\-\-check\-only\-changed\fR -option, but you shouldn\'t use this option if the +option, but you shouldn't use this option if the \fBmysqld\fR server is using the table and you are running it with external locking disabled\&. .RE @@ -902,8 +900,8 @@ Correct the checksum information for the table\&. .\" create-missing-keys option: myisamchk \fB\-\-create\-missing\-keys\fR .sp -Create missing keys. This assumes that the data file is correct and that the -number of rows stored in the index file is correct\&. Enables +Create missing keys. This assumes that the data file is correct and that the +number of rows stored in the index file is correct\&. Enables \fB\-\-quick\fR\&. .RE @@ -960,8 +958,8 @@ the section called \(lqMYISAMCHK TABLE INFORMATION\(rq\&. Overwrite old intermediate files (files with names like \fItbl_name\fR\&.TMD) instead of aborting\&. Add another \fB\-\-force\fR -to avoid 'myisam_sort_buffer_size is too small' errors\&. In this case -we will attempt to do the repair with the given +to avoid 'myisam_sort_buffer_size is too small' errors\&. In this case +we will attempt to do the repair with the given \fBmyisam_sort_buffer_size\fR and dynamically allocate as many management buffers as needed\&. .RE @@ -1287,8 +1285,8 @@ Sort records according to a particular index\&. This makes your data much more l SELECT and ORDER BY -operations that use this index\&. (The first time you use this option to sort a table, it may be very slow\&.) To determine a table\'s index numbers, use -SHOW INDEX, which displays a table\'s indexes in the same order that +operations that use this index\&. (The first time you use this option to sort a table, it may be very slow\&.) To determine a table's index numbers, use +SHOW INDEX, which displays a table's indexes in the same order that \fBmyisamchk\fR sees them\&. Indexes are numbered beginning with 1\&. .sp @@ -1311,7 +1309,7 @@ must unpack key blocks first, then re\-create indexes and pack the key blocks ag .\" stats_method option: myisamchk \fB\-\-stats\-method=name\fR .sp -Specifies how index statistics collection code should treat NULLs\&. Possible values +Specifies how index statistics collection code should treat NULLs\&. Possible values of name are "nulls_unequal" (default), "nulls_equal" (emulate MySQL 4 behavior), and "nulls_ignored"\&. .RE .SH "MYISAMCHK TABLE INFORMATION" @@ -1616,7 +1614,7 @@ sorted index pages\&. Auto increment key, Last value .sp -The key number associated the table\'s +The key number associated the table's AUTO_INCREMENT column, and the most recently generated value for this column\&. These fields do not appear if there is no such column\&. .RE @@ -1757,7 +1755,7 @@ displays some low\-level information: .\} Key .sp -This key\'s number\&. This value is shown only for the first column of the key\&. If this value is missing, the line corresponds to the second or later column of a multiple\-column key\&. For the table shown in the example, there are two +This key's number\&. This value is shown only for the first column of the key\&. If this value is missing, the line corresponds to the second or later column of a multiple\-column key\&. For the table shown in the example, there are two table description lines for the second index\&. This indicates that it is a multiple\-part index with two parts\&. .RE diff --git a/man/myisamlog.1 b/man/myisamlog.1 index a907a9f6b99..dbf50cf7800 100644 --- a/man/myisamlog.1 +++ b/man/myisamlog.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYISAMLOG\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMYISAMLOG\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/myisampack.1 b/man/myisampack.1 index a27b62150cb..89dab7d8cf5 100644 --- a/man/myisampack.1 +++ b/man/myisampack.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYISAMPACK\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBMYISAMPACK\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -125,7 +125,7 @@ Display a help message and exit\&. \fB\-\-backup\fR, \fB\-b\fR .sp -Make a backup of each table\'s data file using the name +Make a backup of each table's data file using the name \fItbl_name\fR\&.OLD\&. .RE .sp @@ -160,9 +160,7 @@ Section\ \&9.5, \(lqCharacter Set Configuration\(rq\&. .sp Write a debugging log\&. A typical \fIdebug_options\fR -string is -\'d:t:o,\fIfile_name\fR\'\&. The default is -\'d:t:o\'\&. +string is 'd:t:o,\fIfile_name\fR'. The default is 'd:t:o'. .RE .sp .RS 4 diff --git a/man/mysql-stress-test.pl.1 b/man/mysql-stress-test.pl.1 index c9cf6cb1069..6024a2ece08 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\&.10" "MariaDB Database System" +.TH "\fBMYSQL\-STRESS\-TEST\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1 index 618fadb0ba0..1677c070f3b 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\&.10" "MariaDB Database System" +.TH "\fBMYSQL\-TEST\-RUN\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -191,7 +191,7 @@ shell> \fBmake test force="\-\-skip\-test=init_file"\fR .PP To run \fBmysql\-test\-run\&.pl\fR -on Windows, you\'ll need either Cygwin or ActiveState Perl to run it\&. You may also need to install the modules required by the script\&. To run the test script, change location into the +on Windows, you'll need either Cygwin or ActiveState Perl to run it\&. You may also need to install the modules required by the script\&. To run the test script, change location into the mysql\-test directory, set the MTR_VS_CONFIG @@ -829,7 +829,7 @@ Add setting from the named file to all generated configs\&. .sp Run all test cases having a name that begins with the given \fIprefix\fR -value, or fulfils the +value, or fulfils the \fIregex\fR\&. This option provides a convenient way to run a family of similarly named tests\&. .sp The argument for the @@ -1038,7 +1038,7 @@ file per source and header file\&. .\" gcov-src-dir option: mysql-test-run.pl \fB\-\-gcov\-src\-dir\fR .sp -Colllect coverage only within the given subdirectory\&. For example, if you're only developing the SQL layer, +Colllect coverage only within the given subdirectory\&. For example, if you're only developing the SQL layer, it makes sense to use \fB--gcov-src-dir=sql\fR\&. .RE .sp @@ -1513,7 +1513,7 @@ number of times\&. .\" report-features option: mysql-test-run.pl \fB\-\-report\-features\fR .sp -First run a "test" that reports MariaDB features, displaying the output of SHOW ENGINES and SHOW VARIABLES\&. This can be +First run a "test" that reports MariaDB features, displaying the output of SHOW ENGINES and SHOW VARIABLES\&. This can be used to verify that binaries are built with all required features\&. .RE .sp @@ -1546,7 +1546,7 @@ Report how much time has been spent on different phases of test execution\&. .sp If a test fails, it is retried up to a maximum of \fIN\fR -runs (default 1)\&. Retries are also limited by the maximum number of failures before stopping, +runs (default 1)\&. Retries are also limited by the maximum number of failures before stopping, set with the \fB-\-retry\-failure\fR option\&. This option has no effect unless \fB\-\-force\fR is also used; without it, test execution will terminate after the first failure\&. @@ -1572,7 +1572,7 @@ may fail in total, as each repetition is considered a new test case, which may i .\" retry-failure option: mysql-test-run.pl \fB\-\-retry\-failure=\fR\fB\fIN\fR\fR .sp -When using the \fB-\-retry\fR option to retry failed tests, +When using the \fB-\-retry\fR option to retry failed tests, stop when N failures have occurred (default 2)\&. Setting it to 0 or 1 effectively turns off retries\&. .RE .sp @@ -1744,7 +1744,7 @@ option, it sets up a secure connection for all test cases\&. In this case, if does not support SSL, \fBmysql\-test\-run\&.pl\fR exits with an error message: -Couldn\'t find support for SSL +Couldn't find support for SSL .RE .sp .RS 4 @@ -1810,7 +1810,7 @@ will stop once the server has been started, but will terminate if the server die .\" start-and-exit option: mysql-test-run.pl \fB\-\-start\-and\-exit\fR .sp -Same +Same \fB\-\-start\fR, but mysql-test-run terminates and leaves just the server running\&. .RE .sp @@ -1877,7 +1877,7 @@ Run the "mysqld" executables using strace. Default options are \fB-f -o var/log/ Create \fBstrace\fR output for -\fBmysqltest\fR, optionally specifying name and path +\fBmysqltest\fR, optionally specifying name and path to the trace program to use\&. .sp Example: \&./mysql\-test\-run\&.pl \-\-strace\-client=ktrace @@ -1895,8 +1895,8 @@ Example: \&./mysql\-test\-run\&.pl \-\-strace\-client=ktrace .\" strace-option option: mysql-test-run.pl \fB\-\-strace\-option\fR=\fR\fB\fIARGS\fR\fR .sp -Option to give -\fBstrace\fR, +Option to give +\fBstrace\fR, replaces default option(s)\&. .RE .sp @@ -2144,9 +2144,9 @@ server with .\" valgrind-mysqltest option: mysql-test-run.pl \fB\-\-valgrind\-mysqltest\fR .sp -Run the +Run the \fBmysqltest\fR -and +and \fBmysql_client_test\fR executables with \fBvalgrind\fR\&. diff --git a/man/mysql.server.1 b/man/mysql.server.1 index 43062e8f88f..b3eff1dd984 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\&.10" "MariaDB Database System" +.TH "\fBMYSQL\&.SERVER\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/mytop.1 b/man/mytop.1 index 9594caade78..6585439fce9 100644 --- a/man/mytop.1 +++ b/man/mytop.1 @@ -1,4 +1,4 @@ -.TH MYTOP "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH MYTOP "1" "15 May 2020" "MariaDB 10.11" "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 f225e074f10..94a4bdb3be5 100644 --- a/man/perror.1 +++ b/man/perror.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBPERROR\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBPERROR\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/replace.1 b/man/replace.1 index d8cc27e0bab..f5327815bb1 100644 --- a/man/replace.1 +++ b/man/replace.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBREPLACE\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBREPLACE\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/resolve_stack_dump.1 b/man/resolve_stack_dump.1 index 6f59e8ef4b4..df97e405b86 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\&.10" "MariaDB Database System" +.TH "\fBRESOLVE_STACK_DUMP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/resolveip.1 b/man/resolveip.1 index 56895b50bfc..8abc823b24b 100644 --- a/man/resolveip.1 +++ b/man/resolveip.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBRESOLVEIP\FR" "1" "15 May 2020" "MariaDB 10\&.10" "MariaDB Database System" +.TH "\fBRESOLVEIP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_common.1 b/man/wsrep_sst_common.1 index 7b3ac5dd244..9fd5122c4b4 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\&.10" "MariaDB Database System" +.TH "\fBWSREP_SST_COMMON\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_mariabackup.1 b/man/wsrep_sst_mariabackup.1 index 21a73de16db..7259b028bbc 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\&.10" "MariaDB Database System" +.TH "\fBWSREP_SST_MARIABACKUP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_mysqldump.1 b/man/wsrep_sst_mysqldump.1 index 55a859bf979..56581ae889e 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\&.10" "MariaDB Database System" +.TH "\fBWSREP_SST_MYSQLDUMP\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_rsync.1 b/man/wsrep_sst_rsync.1 index 02862256f1c..155cb8ce637 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\&.10" "MariaDB Database System" +.TH "\fBWSREP_SST_RSYNC\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/man/wsrep_sst_rsync_wan.1 b/man/wsrep_sst_rsync_wan.1 index 0736c03f9e9..3eb67b3d718 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\&.10" "MariaDB Database System" +.TH "\fBWSREP_SST_RSYNC_WAN\fR" "1" "15 May 2020" "MariaDB 10.11" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- diff --git a/mysql-test/include/analyze-format.inc b/mysql-test/include/analyze-format.inc index 7628156b205..907f4e71010 100644 --- a/mysql-test/include/analyze-format.inc +++ b/mysql-test/include/analyze-format.inc @@ -1,3 +1,7 @@ -# The time on ANALYSE FORMAT=JSON is rather variable +# Remove non-deterministic parts of ANALYZE FORMAT=JSON output: +# - any timings +# - Buffer sizes (depend on pointer size) +# - r_engine_stats depends on buffer pool state and whether old record versions +# were purged. ---replace_regex /("(r_[a-z_]*_time(_in_progress)?_ms|r_buffer_size|cost)": )[^, \n]*/\1"REPLACED"/ +--replace_regex /("(r_[a-z_]*_time(_in_progress)?_ms|r_buffer_size|cost)": )[^, \n]*/\1"REPLACED"/ /("r_engine_stats":) {[^}]*}/\1 REPLACED/ diff --git a/mysql-test/include/log_grep.inc b/mysql-test/include/log_grep.inc new file mode 100644 index 00000000000..a2b0c383ae0 --- /dev/null +++ b/mysql-test/include/log_grep.inc @@ -0,0 +1,85 @@ +if ($log_expected_matches) { + --echo [log_grep.inc] file: $log_file pattern: $grep_pattern expected_matches: $log_expected_matches +} +if (!$log_expected_matches) { + --echo [log_grep.inc] file: $log_file pattern: $grep_pattern +} +--let LOG_GREP_PERL_RESULT=$MYSQL_TMP_DIR/log_grep_perl_result.test +perl; + + open my $command_file, ">", "$ENV{'LOG_GREP_PERL_RESULT'}" or die "Cannot create file"; + + $log_file= $ENV{'log_file'}; + $log_file_full_path= $ENV{'log_file_full_path'}; + $log_slow_rate_test= $ENV{'log_slow_rate_test'}; + open(FILE, "$log_file_full_path") + or die("Cannot open file $log_file_full_path: $!\n"); + + if ($log_slow_rate_test) { + $one= 0; + $two= 0; + $three= 0; + while() { + $one++ if(/'connection_one'/); + $two++ if(/'connection_two'/); + $three++ if(/'connection_three'/); + } + $sum= $one + $two + $three; + $zero= 0; + if ($one == 0) { + $zero++; + } + if ($two == 0) { + $zero++; + } + if ($three == 0) { + $zero++; + } + print "[log_grep.inc] sum: $sum\n"; + print "[log_grep.inc] zero: $zero\n"; + } + else { + $grep_pattern= $ENV{'grep_pattern'}; + $lines= 0; + while() { + $lines++ if (/$grep_pattern/); + } + $log_expected_matches= $ENV{'log_expected_matches'}; + if ($log_expected_matches) { + if ($log_expected_matches != $lines) { + print "[log_grep.inc] ERROR: expected matches: $log_expected_matches, actual matches: $lines\n"; + print "[log_grep.inc] log file at $log_file_full_path\n"; + close(FILE); + open(FILE, "$log_file_full_path") + or die("Cannot open file $log_file_full_path: $!\n"); + while () { + print ; + } + print $command_file "--let \$log_grep_failed= 1;\n"; + } else { + print "[log_grep.inc] found expected match count: $log_expected_matches\n"; + } + } else { + print "[log_grep.inc] lines: $lines\n"; + } + } + close(FILE); + close($command_file); +EOF +--source $LOG_GREP_PERL_RESULT +--remove_file $LOG_GREP_PERL_RESULT +if ($log_grep_failed) +{ + SHOW SESSION STATUS LIKE 'Slow_queries'; + SHOW GLOBAL VARIABLES LIKE 'log%'; + SHOW GLOBAL VARIABLES LIKE 'long_query_time'; + SHOW GLOBAL VARIABLES LIKE 'min_examined_row_limit'; + SHOW GLOBAL VARIABLES LIKE 'query_cache%'; + SHOW GLOBAL VARIABLES LIKE 'slow_query%'; + SHOW SESSION VARIABLES LIKE 'log%'; + SHOW SESSION VARIABLES LIKE 'long_query_time'; + SHOW SESSION VARIABLES LIKE 'min_examined_row_limit'; + SHOW SESSION VARIABLES LIKE 'query_cache%'; + SHOW SESSION VARIABLES LIKE 'slow_query%'; + --die Testcase failed! +} diff --git a/mysql-test/include/log_slow_cleanup.inc b/mysql-test/include/log_slow_cleanup.inc new file mode 100644 index 00000000000..f3d87275a31 --- /dev/null +++ b/mysql-test/include/log_slow_cleanup.inc @@ -0,0 +1,6 @@ +--remove_files_wildcard $MYSQLTEST_VARDIR/tmp $log_slow_prefix-*.slog +--disable_query_log +EVAL SET GLOBAL log_output= $log_output_old; +EVAL SET GLOBAL slow_query_log_file= "$slow_query_log_file_old"; +EVAL SET GLOBAL slow_query_log= $slow_query_log_old; +--enable_query_log diff --git a/mysql-test/include/log_slow_grep.inc b/mysql-test/include/log_slow_grep.inc new file mode 100644 index 00000000000..004c8ccefbc --- /dev/null +++ b/mysql-test/include/log_slow_grep.inc @@ -0,0 +1,25 @@ +# Common extensions to the slow query log +--let grep_pattern = ^# Thread_id: .+ Schema: .+ QC_hit: (Yes|No)\$ +--let log_expected_matches = $log_slow_verbosity_expected_matches +--source include/log_grep.inc +--let grep_pattern = ^# Query_time: \d+\.\d+ Lock_time: \d+\.\d+ Rows_sent: \d+ Rows_examined: \d+\$ +--source include/log_grep.inc + --let grep_pattern = ^# Rows_affected: \d+ Bytes_sent: \d+\$ +--source include/log_grep.inc + +# Query plan +--let log_expected_matches = $log_slow_verbosity_queryplan_expected_matches +--let grep_pattern = ^# Full_scan: (Yes|No) Full_join: (Yes|No) Tmp_table: (Yes|No) Tmp_table_on_disk: (Yes|No)\$ +--source include/log_grep.inc +--let grep_pattern = ^# Filesort: (Yes|No) Filesort_on_disk: (Yes|No) Merge_passes: \d+\ Priority_queue: (Yes|No)\$ +--source include/log_grep.inc + +# Temp tables +--let log_expected_matches = $log_slow_verbosity_tmptable_expected_matches +--source include/log_grep.inc +--let grep_pattern = ^# Tmp_tables: \d+ Tmp_disk_tables: \d+\$ +--source include/log_grep.inc + +# InnoDB/Engines +--let log_expected_matches = $log_slow_innodb_expected_matches +--let grep_pattern = ^# Pages_accessed: \d+ Pages_read: \d+ Pages_updated: \d+ Old_rows_read: \d+\n# Pages_read_time: \d+\.\d+ Engine_time: \d+\.\d+\$ diff --git a/mysql-test/include/log_slow_prepare.inc b/mysql-test/include/log_slow_prepare.inc new file mode 100644 index 00000000000..7abc56b7fb5 --- /dev/null +++ b/mysql-test/include/log_slow_prepare.inc @@ -0,0 +1,8 @@ +--disable_query_log +--let slow_query_log_old= `select @@slow_query_log` +--let slow_query_log_file_old= `select @@slow_query_log_file` +--let log_output_old= `select @@log_output` + +SET GLOBAL slow_query_log=0; +SET GLOBAL log_output=FILE; +--enable_query_log diff --git a/mysql-test/include/log_slow_start.inc b/mysql-test/include/log_slow_start.inc new file mode 100644 index 00000000000..e562a6976d3 --- /dev/null +++ b/mysql-test/include/log_slow_start.inc @@ -0,0 +1,6 @@ +--disable_query_log +--let log_file_full_path=$MYSQLTEST_VARDIR/tmp/$log_file.slog +--echo [slow_log_start.inc] $log_file +EVAL SET GLOBAL slow_query_log_file="$log_file_full_path"; +SET GLOBAL slow_query_log=1; +--enable_query_log diff --git a/mysql-test/include/log_slow_stop.inc b/mysql-test/include/log_slow_stop.inc new file mode 100644 index 00000000000..7ee24af9d8a --- /dev/null +++ b/mysql-test/include/log_slow_stop.inc @@ -0,0 +1,4 @@ +--disable_query_log +SET GLOBAL slow_query_log=0; +--echo [log_slow_stop.inc] $log_file +--enable_query_log diff --git a/mysql-test/main/analyze_engine_stats.combinations b/mysql-test/main/analyze_engine_stats.combinations new file mode 100644 index 00000000000..09620f9f4da --- /dev/null +++ b/mysql-test/main/analyze_engine_stats.combinations @@ -0,0 +1,5 @@ +[slow_query_log_on] +slow_query_log=ON + +[slow_query_log_off] +slow_query_log=OFF diff --git a/mysql-test/main/analyze_engine_stats.result b/mysql-test/main/analyze_engine_stats.result new file mode 100644 index 00000000000..42cc366ae62 --- /dev/null +++ b/mysql-test/main/analyze_engine_stats.result @@ -0,0 +1,121 @@ +create table t1 ( +pk int not null, +a varchar(64), +b varchar(64), +c varchar(64) +) engine=innodb; +insert into t1 select +seq, seq, seq, seq +from +seq_1_to_10000; +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 +# Note the r_engine_stats below. Only non-zero members are printed +select '$out' as X; +X +{ + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, + "query_block": { + "select_id": 1, + "cost": 1.6664988, + "r_loops": 1, + "r_total_time_ms": "REPLACED", + "nested_loop": [ + { + "table": { + "table_name": "t1", + "access_type": "ALL", + "loops": 1, + "r_loops": 1, + "rows": 10000, + "r_rows": 10000, + "cost": 1.6664988, + "r_table_time_ms": "REPLACED", + "r_other_time_ms": "REPLACED", + "r_engine_stats": { + "pages_accessed": "REPLACED" + }, + "filtered": 100, + "r_filtered": 100, + "attached_condition": "t1.pk < 120000" + } + } + ] + } +} +set @js='$out'; +set @out=(select json_extract(@js,'$**.r_engine_stats.pages_accessed')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0 as PAGES_ACCESSED_MORE_THAN_ZERO; +PAGES_ACCESSED_MORE_THAN_ZERO +1 +# +# Try an UPDATE +# +select '$out' as X; +X +{ + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, + "query_block": { + "select_id": 1, + "r_total_time_ms": "REPLACED", + "table": { + "update": 1, + "table_name": "t1", + "access_type": "ALL", + "rows": 10000, + "r_rows": 10000, + "r_filtered": 100, + "r_total_time_ms": "REPLACED", + "r_engine_stats": { + "pages_accessed": "REPLACED", + "pages_updated": "REPLACED" + }, + "attached_condition": "t1.pk < 120000" + } + } +} +set @js='$out'; +set @out=(select json_extract(@js,'$**.r_engine_stats.pages_updated')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0 as PAGES_UPDATED_MORE_THAN_ZERO; +PAGES_UPDATED_MORE_THAN_ZERO +1 +# +# Try a DELETE +# +select '$out' as X; +X +{ + "query_optimization": { + "r_total_time_ms": "REPLACED" + }, + "query_block": { + "select_id": 1, + "r_total_time_ms": "REPLACED", + "table": { + "delete": 1, + "table_name": "t1", + "access_type": "ALL", + "rows": 10000, + "r_rows": 10000, + "r_filtered": 50, + "r_total_time_ms": "REPLACED", + "r_engine_stats": { + "pages_accessed": "REPLACED", + "pages_updated": "REPLACED" + }, + "attached_condition": "t1.pk MOD 2 = 1" + } + } +} +set @js='$out'; +set @out=(select json_extract(@js,'$**.r_engine_stats.pages_updated')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0 as PAGES_UPDATED_MORE_THAN_ZERO; +PAGES_UPDATED_MORE_THAN_ZERO +1 +drop table t1; diff --git a/mysql-test/main/analyze_engine_stats.test b/mysql-test/main/analyze_engine_stats.test new file mode 100644 index 00000000000..a26c65a1aa4 --- /dev/null +++ b/mysql-test/main/analyze_engine_stats.test @@ -0,0 +1,64 @@ +# +# Tests for r_engine_stats in ANALYZE FORMAT=JSON output +# +--source include/analyze-format.inc +--source include/have_sequence.inc +--source include/have_innodb.inc + +create table t1 ( + pk int not null, + a varchar(64), + b varchar(64), + c varchar(64) +) engine=innodb; + +insert into t1 select + seq, seq, seq, seq +from + seq_1_to_10000; + +analyze table t1 persistent for all; + +--echo # Note the r_engine_stats below. Only non-zero members are printed +let $out=` +ANALYZE FORMAT=json +select * from t1 where pk < 120000; +`; + +# Don't use "source include/analyze-format.inc" as it replaces r_engine_stats +# Replace the "pages_accessed" value, too, as it is different for some +# platforms... +--replace_regex /("(r_[a-z_]*_time(_in_progress)?_ms|r_buffer_size|pages_accessed)": )[^, \n]*/\1"REPLACED"/ +evalp select '$out' as X; + +evalp set @js='$out'; +set @out=(select json_extract(@js,'$**.r_engine_stats.pages_accessed')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0 as PAGES_ACCESSED_MORE_THAN_ZERO; + +--echo # +--echo # Try an UPDATE +--echo # + +let $out=`analyze format=json update t1 set b = b-1 where pk < 120000`; + +--replace_regex /("(r_[a-z_]*_time_ms|pages_accessed|pages_updated)": )[^, \n]*/\1"REPLACED"/ +evalp select '$out' as X; + +evalp set @js='$out'; +set @out=(select json_extract(@js,'$**.r_engine_stats.pages_updated')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0 as PAGES_UPDATED_MORE_THAN_ZERO; + +--echo # +--echo # Try a DELETE +--echo # +let $out=`analyze format=json delete from t1 where mod(pk,2)=1`; + +--replace_regex /("(r_[a-z_]*_time_ms|pages_accessed|pages_updated)": )[^, \n]*/\1"REPLACED"/ +evalp select '$out' as X; + +evalp set @js='$out'; +set @out=(select json_extract(@js,'$**.r_engine_stats.pages_updated')); +select cast(json_extract(@out,'$[0]') as DOUBLE) > 0 as PAGES_UPDATED_MORE_THAN_ZERO; + +drop table t1; + diff --git a/mysql-test/main/analyze_format_json.result b/mysql-test/main/analyze_format_json.result index 0e1ea88404b..00fdc10f84a 100644 --- a/mysql-test/main/analyze_format_json.result +++ b/mysql-test/main/analyze_format_json.result @@ -25,6 +25,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 30, "attached_condition": "t0.a < 3" @@ -64,6 +65,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 0, "attached_condition": "t0.a > 9 and t0.a is not null" @@ -83,6 +85,7 @@ ANALYZE "rows": 1, "r_rows": null, "cost": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": null } @@ -119,6 +122,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "t0.a is not null" @@ -140,6 +144,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 40, "attached_condition": "t1.b < 4" @@ -177,6 +182,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 20, "attached_condition": "tbl1.b < 20" @@ -194,6 +200,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 60, "attached_condition": "tbl2.b < 60" @@ -235,6 +242,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 20, "attached_condition": "tbl1.b < 20" @@ -252,6 +260,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 60, "attached_condition": "tbl2.b < 60" @@ -302,6 +311,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "t1.a is not null" @@ -323,6 +333,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "using_index": true @@ -368,6 +379,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 50, "attached_condition": "test.t1.a < 5" @@ -407,7 +419,8 @@ ANALYZE "rows": 1000, "r_rows": 1000, "r_filtered": 100, - "r_total_time_ms": "REPLACED" + "r_total_time_ms": "REPLACED", + "r_engine_stats": REPLACED } } } @@ -439,6 +452,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 50, "index_condition": "t1.pk < 10", @@ -470,6 +484,7 @@ ANALYZE "r_rows": 10, "r_filtered": 50, "r_total_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "attached_condition": "t1.pk < 10 and t1.b > 4" } } @@ -518,6 +533,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -546,6 +562,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 98.13542689 } @@ -593,6 +610,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 50, "attached_condition": "tbl1.a < 5" @@ -620,6 +638,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 20, "attached_condition": "tbl2.a in (2,3)" @@ -680,6 +699,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -722,6 +742,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -778,6 +799,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -818,6 +840,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -834,6 +857,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 0, "attached_condition": "(t2.b,t2.b in (subquery#2))" @@ -869,6 +893,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -936,6 +961,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -952,6 +978,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 0, "attached_condition": "t3.f3 in (1,2)" @@ -985,6 +1012,7 @@ ANALYZE "rows": 2, "r_rows": null, "cost": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": null } @@ -999,6 +1027,7 @@ ANALYZE "rows": 2, "r_rows": null, "cost": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": null }, @@ -1056,6 +1085,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 0, "attached_condition": "t1.a < 0" @@ -1089,6 +1119,7 @@ ANALYZE "rows": 10, "r_rows": null, "cost": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": null, "attached_condition": "t2.a < t1.a" @@ -1151,6 +1182,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 10, "r_filtered": 10, "attached_condition": "t11.a < 100" @@ -1168,6 +1200,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 70, "r_filtered": 70, "attached_condition": "t10.a < 700" @@ -1215,6 +1248,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 10, "r_filtered": 10, "attached_condition": "t11.a < 100 and t11.b is not null" @@ -1236,6 +1270,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 0.209580004, "r_filtered": 70, "attached_condition": "t10.a < 700" diff --git a/mysql-test/main/analyze_format_json_timings.result b/mysql-test/main/analyze_format_json_timings.result index 4686359186e..1b5f97766a9 100644 --- a/mysql-test/main/analyze_format_json_timings.result +++ b/mysql-test/main/analyze_format_json_timings.result @@ -57,6 +57,7 @@ X "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "t1.a < 700 and t1.b is not null" @@ -78,6 +79,7 @@ X "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 10, "r_filtered": 20, "attached_condition": "t2.a < 100" @@ -153,6 +155,7 @@ X "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "t1.a is not null" @@ -174,6 +177,7 @@ X "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 10, "r_filtered": 100 }, diff --git a/mysql-test/main/analyze_stmt_orderby.result b/mysql-test/main/analyze_stmt_orderby.result index 7008ad8dea3..020e68f34de 100644 --- a/mysql-test/main/analyze_stmt_orderby.result +++ b/mysql-test/main/analyze_stmt_orderby.result @@ -55,7 +55,8 @@ ANALYZE "rows": 10000, "r_rows": 10000, "r_filtered": 100, - "r_total_time_ms": "REPLACED" + "r_total_time_ms": "REPLACED", + "r_engine_stats": REPLACED } } } @@ -111,6 +112,7 @@ ANALYZE "r_rows": 10, "r_filtered": 100, "r_total_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "attached_condition": "t2.a < 10" } } @@ -163,7 +165,8 @@ ANALYZE "rows": 10000, "r_rows": 10000, "r_filtered": 100, - "r_total_time_ms": "REPLACED" + "r_total_time_ms": "REPLACED", + "r_engine_stats": REPLACED } } } @@ -251,6 +254,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "t0.a is not null" @@ -272,6 +276,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -365,6 +370,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "t0.a is not null" @@ -388,6 +394,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -440,6 +447,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 50, "attached_condition": "t2.a MOD 2 = 0" @@ -499,6 +507,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -515,6 +524,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, @@ -591,6 +601,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 80, "attached_condition": "t6.b > 0 and t6.a <= 5" @@ -608,6 +619,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, @@ -728,6 +740,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "using_index_for_group_by": true diff --git a/mysql-test/main/analyze_stmt_slow_query_log-master.opt b/mysql-test/main/analyze_stmt_slow_query_log-master.opt index 1c80c45b0c1..a0fe99a1676 100644 --- a/mysql-test/main/analyze_stmt_slow_query_log-master.opt +++ b/mysql-test/main/analyze_stmt_slow_query_log-master.opt @@ -1 +1 @@ ---slow-query-log --long-query-time=0.00001 --log-slow-verbosity=query_plan,explain +--slow-query-log --long-query-time=0.00001 --log-slow-verbosity=query_plan,explain,innodb diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result index ed416e7b355..8212cb213bf 100644 --- a/mysql-test/main/cte_recursive.result +++ b/mysql-test/main/cte_recursive.result @@ -3936,6 +3936,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "t1.a1 is not null" @@ -3986,6 +3987,7 @@ ANALYZE "r_loops": 0, "rows": 1, "r_rows": null, + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": null, "using_index": true @@ -4014,6 +4016,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "tt2.b1 is not null" @@ -4250,6 +4253,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -4276,6 +4280,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "t1.c is not null" @@ -4388,6 +4393,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } diff --git a/mysql-test/main/ctype_collate_context.result b/mysql-test/main/ctype_collate_context.result index 4ef3d9a6c7b..c924f11d9e2 100644 --- a/mysql-test/main/ctype_collate_context.result +++ b/mysql-test/main/ctype_collate_context.result @@ -3688,3 +3688,31 @@ DROP TABLE results_alter_db; DROP TABLE results_create_table; DROP TABLE results_alter_table; DROP TABLE results_convert_table; +# +# MDEV-30003 Assertion failure upon 2nd execution of SP trying to set collation on non-existing database +# +CREATE PROCEDURE p() ALTER SCHEMA db DEFAULT COLLATE = utf8_bin; +CALL p; +ERROR HY000: Can't create/write to file 'db.opt' (Errcode: 2 "No such file or directory") +CALL p; +ERROR HY000: Can't create/write to file 'db.opt' (Errcode: 2 "No such file or directory") +DROP PROCEDURE p; +CREATE DATABASE db1; +CREATE PROCEDURE p() CREATE DATABASE db1 COLLATE DEFAULT; +CALL p; +ERROR HY000: Can't create database 'db1'; database exists +CALL p; +ERROR HY000: Can't create database 'db1'; database exists +DROP DATABASE db1; +DROP PROCEDURE p; +CREATE TABLE t1 (a INT); +CREATE PROCEDURE p() CREATE TABLE t1 (a INT) COLLATE DEFAULT; +CALL p; +ERROR 42S01: Table 't1' already exists +CALL p; +ERROR 42S01: Table 't1' already exists +DROP TABLE t1; +DROP PROCEDURE p; +# +# End of 10.9 tests +# diff --git a/mysql-test/main/ctype_collate_context.test b/mysql-test/main/ctype_collate_context.test index 6934bf487c3..95a46f2d830 100644 --- a/mysql-test/main/ctype_collate_context.test +++ b/mysql-test/main/ctype_collate_context.test @@ -366,3 +366,38 @@ DROP TABLE results_alter_db; DROP TABLE results_create_table; DROP TABLE results_alter_table; DROP TABLE results_convert_table; + +--echo # +--echo # MDEV-30003 Assertion failure upon 2nd execution of SP trying to set collation on non-existing database +--echo # + +CREATE PROCEDURE p() ALTER SCHEMA db DEFAULT COLLATE = utf8_bin; +--replace_regex /to file '.*db.opt'/to file 'db.opt'/ +--error 1 +CALL p; +--replace_regex /to file '.*db.opt'/to file 'db.opt'/ +--error 1 +CALL p; +DROP PROCEDURE p; + +CREATE DATABASE db1; +CREATE PROCEDURE p() CREATE DATABASE db1 COLLATE DEFAULT; +--error ER_DB_CREATE_EXISTS +CALL p; +--error ER_DB_CREATE_EXISTS +CALL p; +DROP DATABASE db1; +DROP PROCEDURE p; + +CREATE TABLE t1 (a INT); +CREATE PROCEDURE p() CREATE TABLE t1 (a INT) COLLATE DEFAULT; +--error ER_TABLE_EXISTS_ERROR +CALL p; +--error ER_TABLE_EXISTS_ERROR +CALL p; +DROP TABLE t1; +DROP PROCEDURE p; + +--echo # +--echo # End of 10.9 tests +--echo # diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index 61fb0e52985..f87c8992a45 100644 --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@ -21522,6 +21522,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 50, "attached_condition": "t1.a = 3" diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result index 8adf9281b87..81a0165ab03 100644 --- a/mysql-test/main/derived_split_innodb.result +++ b/mysql-test/main/derived_split_innodb.result @@ -386,6 +386,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -406,6 +407,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "trigcond(trigcond(t1.b is not null))" @@ -427,6 +429,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "trigcond(trigcond(t1.b is not null))" @@ -476,6 +479,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -492,6 +496,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, diff --git a/mysql-test/main/except.result b/mysql-test/main/except.result index e08427d9c65..40a77fcd650 100644 --- a/mysql-test/main/except.result +++ b/mysql-test/main/except.result @@ -106,6 +106,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -132,6 +133,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -194,6 +196,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -220,6 +223,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -401,6 +405,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -417,6 +422,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, @@ -452,6 +458,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -468,6 +475,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, @@ -540,6 +548,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -556,6 +565,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, @@ -591,6 +601,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -607,6 +618,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, diff --git a/mysql-test/main/except_all.result b/mysql-test/main/except_all.result index ffc9ddb7601..5806a491caa 100644 --- a/mysql-test/main/except_all.result +++ b/mysql-test/main/except_all.result @@ -169,6 +169,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -195,6 +196,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -262,6 +264,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -288,6 +291,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -534,6 +538,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -550,6 +555,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, @@ -585,6 +591,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -601,6 +608,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, @@ -672,6 +680,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -688,6 +697,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, @@ -723,6 +733,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -739,6 +750,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, diff --git a/mysql-test/main/explain_json.result b/mysql-test/main/explain_json.result index 38bea4b4d6a..cd55f7ddf65 100644 --- a/mysql-test/main/explain_json.result +++ b/mysql-test/main/explain_json.result @@ -1309,6 +1309,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "using_index_for_group_by": true @@ -1718,6 +1719,7 @@ ANALYZE "r_loops": 0, "rows": 0, "r_rows": null, + "r_engine_stats": REPLACED, "filtered": 0, "r_filtered": null, "impossible_on_condition": true @@ -1734,6 +1736,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -1810,6 +1813,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -1830,6 +1834,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "trigcond(t2.pk is null) and trigcond(trigcond(t1.a is not null))", @@ -1912,6 +1917,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "t1.a is not null" @@ -1933,6 +1939,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "using_index": true, @@ -2030,6 +2037,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "t3.a is not null" @@ -2052,6 +2060,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "index_condition_bka": "t4.b + 1 <= t3.b + 1" diff --git a/mysql-test/main/explain_json_format_partitions.result b/mysql-test/main/explain_json_format_partitions.result index 858b2539eb0..6cdac94f20c 100644 --- a/mysql-test/main/explain_json_format_partitions.result +++ b/mysql-test/main/explain_json_format_partitions.result @@ -53,6 +53,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 30, "attached_condition": "t1.a in (2,3,4)" @@ -80,6 +81,7 @@ ANALYZE "r_rows": 10, "r_filtered": 30, "r_total_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "attached_condition": "t1.a in (2,3,4)" } } @@ -103,6 +105,7 @@ ANALYZE "r_rows": 10, "r_filtered": 0, "r_total_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "attached_condition": "t1.a in (20,30,40)" } } diff --git a/mysql-test/main/fetch_first.result b/mysql-test/main/fetch_first.result index 1be71f24582..74ac8cc10f5 100644 --- a/mysql-test/main/fetch_first.result +++ b/mysql-test/main/fetch_first.result @@ -472,6 +472,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } diff --git a/mysql-test/main/intersect.result b/mysql-test/main/intersect.result index 9e1b60ca381..a71da056e8f 100644 --- a/mysql-test/main/intersect.result +++ b/mysql-test/main/intersect.result @@ -139,6 +139,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -165,6 +166,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -191,6 +193,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -253,6 +256,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -279,6 +283,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -305,6 +310,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -460,6 +466,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -486,6 +493,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -502,6 +510,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, @@ -573,6 +582,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -599,6 +609,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -615,6 +626,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, diff --git a/mysql-test/main/intersect_all.result b/mysql-test/main/intersect_all.result index 3b1f3f2ac47..ad4ade45862 100644 --- a/mysql-test/main/intersect_all.result +++ b/mysql-test/main/intersect_all.result @@ -151,6 +151,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -177,6 +178,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -203,6 +205,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -265,6 +268,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -291,6 +295,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -317,6 +322,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -491,6 +497,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -517,6 +524,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -533,6 +541,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, @@ -604,6 +613,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -630,6 +640,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -646,6 +657,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, diff --git a/mysql-test/main/kill_debug.result b/mysql-test/main/kill_debug.result index 061e7602383..0c910906b92 100644 --- a/mysql-test/main/kill_debug.result +++ b/mysql-test/main/kill_debug.result @@ -234,6 +234,7 @@ connection default; set debug_sync='now WAIT_FOR go0'; set debug_sync='found_killee SIGNAL go1 WAIT_FOR go2'; kill $id; +select variable_value into @threads_cached from information_schema.global_status where variable_name='threads_cached'; 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 index 32a764004e3..6bade1d8d90 100644 --- a/mysql-test/main/kill_debug.test +++ b/mysql-test/main/kill_debug.test @@ -313,6 +313,12 @@ connection default; set debug_sync='now WAIT_FOR go0'; set debug_sync='found_killee SIGNAL go1 WAIT_FOR go2'; evalp kill $id; +select variable_value into @threads_cached from information_schema.global_status where variable_name='threads_cached'; set debug_sync='now SIGNAL go3'; +if (`select @@thread_handling != 'pool-of-threads'`) { + # cannot check that a thread was added to thread pool on windows, but the test works there w/o the wait + let wait_condition= select variable_value>@threads_cached from information_schema.global_status where variable_name='threads_cached'; + source include/wait_condition.inc; +} drop table t1; set debug_sync='reset'; diff --git a/mysql-test/main/log_slow_innodb.result b/mysql-test/main/log_slow_innodb.result new file mode 100644 index 00000000000..a7c2ac86eed --- /dev/null +++ b/mysql-test/main/log_slow_innodb.result @@ -0,0 +1,78 @@ +CREATE TABLE t1(a INT primary key, b int) ENGINE=InnoDB; +INSERT INTO t1 select seq, seq from seq_1_to_1000; +SET SESSION min_examined_row_limit=0; +SET SESSION long_query_time=0; +SET SESSION log_slow_verbosity='innodb,query_plan'; +[slow_log_start.inc] log_slow_innodb-verbosity_1 +SELECT sum(a+b) FROM t1; +sum(a+b) +1001000 +UPDATE t1 set b=b+1 where a=1 or a=999; +[log_slow_stop.inc] log_slow_innodb-verbosity_1 +[log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Thread_id: .+ Schema: .+ QC_hit: (Yes|No)$ expected_matches: 3 +[log_grep.inc] found expected match count: 3 +[log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Query_time: \d+\.\d+ Lock_time: \d+\.\d+ Rows_sent: \d+ Rows_examined: \d+$ expected_matches: 3 +[log_grep.inc] found expected match count: 3 +[log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Rows_affected: \d+ Bytes_sent: \d+$ expected_matches: 3 +[log_grep.inc] found expected match count: 3 +[log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Full_scan: (Yes|No) Full_join: (Yes|No) Tmp_table: (Yes|No) Tmp_table_on_disk: (Yes|No)$ +[log_grep.inc] lines: 1 +[log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Filesort: (Yes|No) Filesort_on_disk: (Yes|No) Merge_passes: \d+\ Priority_queue: (Yes|No)$ +[log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Filesort: (Yes|No) Filesort_on_disk: (Yes|No) Merge_passes: \d+\ Priority_queue: (Yes|No)$ +[log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_1 pattern: ^# Tmp_tables: \d+ Tmp_disk_tables: \d+$ +[log_grep.inc] lines: 0 +SET SESSION log_slow_verbosity='innodb,query_plan'; +[slow_log_start.inc] log_slow_innodb-verbosity_2 +SELECT 1; +1 +1 +[log_slow_stop.inc] log_slow_innodb-verbosity_2 +[log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Thread_id: .+ Schema: .+ QC_hit: (Yes|No)$ expected_matches: 2 +[log_grep.inc] found expected match count: 2 +[log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Query_time: \d+\.\d+ Lock_time: \d+\.\d+ Rows_sent: \d+ Rows_examined: \d+$ expected_matches: 2 +[log_grep.inc] found expected match count: 2 +[log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Rows_affected: \d+ Bytes_sent: \d+$ expected_matches: 2 +[log_grep.inc] found expected match count: 2 +[log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Full_scan: (Yes|No) Full_join: (Yes|No) Tmp_table: (Yes|No) Tmp_table_on_disk: (Yes|No)$ +[log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Filesort: (Yes|No) Filesort_on_disk: (Yes|No) Merge_passes: \d+\ Priority_queue: (Yes|No)$ +[log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Filesort: (Yes|No) Filesort_on_disk: (Yes|No) Merge_passes: \d+\ Priority_queue: (Yes|No)$ +[log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_2 pattern: ^# Tmp_tables: \d+ Tmp_disk_tables: \d+$ +[log_grep.inc] lines: 0 +SET SESSION log_slow_verbosity='query_plan'; +[log_slow_stop.inc] log_slow_innodb-verbosity_3 +--source include/log_slow_start.inc +INSERT INTO t1 VALUE(1000) +[log_grep.inc] file: log_slow_innodb-verbosity_3 +--source include/log_slow_start.inc +INSERT INTO t1 VALUE(1000) pattern: ^# Thread_id: .+ Schema: .+ QC_hit: (Yes|No)$ expected_matches: 2 +[log_grep.inc] found expected match count: 2 +[log_grep.inc] file: log_slow_innodb-verbosity_3 +--source include/log_slow_start.inc +INSERT INTO t1 VALUE(1000) pattern: ^# Query_time: \d+\.\d+ Lock_time: \d+\.\d+ Rows_sent: \d+ Rows_examined: \d+$ expected_matches: 2 +[log_grep.inc] found expected match count: 2 +[log_grep.inc] file: log_slow_innodb-verbosity_3 +--source include/log_slow_start.inc +INSERT INTO t1 VALUE(1000) pattern: ^# Rows_affected: \d+ Bytes_sent: \d+$ expected_matches: 2 +[log_grep.inc] found expected match count: 2 +[log_grep.inc] file: log_slow_innodb-verbosity_3 +--source include/log_slow_start.inc +INSERT INTO t1 VALUE(1000) pattern: ^# Full_scan: (Yes|No) Full_join: (Yes|No) Tmp_table: (Yes|No) Tmp_table_on_disk: (Yes|No)$ +[log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_3 +--source include/log_slow_start.inc +INSERT INTO t1 VALUE(1000) pattern: ^# Filesort: (Yes|No) Filesort_on_disk: (Yes|No) Merge_passes: \d+\ Priority_queue: (Yes|No)$ +[log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_3 +--source include/log_slow_start.inc +INSERT INTO t1 VALUE(1000) pattern: ^# Filesort: (Yes|No) Filesort_on_disk: (Yes|No) Merge_passes: \d+\ Priority_queue: (Yes|No)$ +[log_grep.inc] lines: 0 +[log_grep.inc] file: log_slow_innodb-verbosity_3 +--source include/log_slow_start.inc +INSERT INTO t1 VALUE(1000) pattern: ^# Tmp_tables: \d+ Tmp_disk_tables: \d+$ +[log_grep.inc] lines: 0 +DROP TABLE t1; diff --git a/mysql-test/main/log_slow_innodb.test b/mysql-test/main/log_slow_innodb.test new file mode 100644 index 00000000000..2cd2b654ee5 --- /dev/null +++ b/mysql-test/main/log_slow_innodb.test @@ -0,0 +1,75 @@ +# +# Test the extended slow query log output format for various log_slow_verbosity values. +# Test that InnoDB stats for the extended slow query log are collected. +# +# This test file is based on tests from Percona server +# + +--source include/have_innodb.inc +--source include/have_sequence.inc +--source include/log_slow_prepare.inc +# Cannot be used with view protocol as number of temporary tables changes +--source include/no_view_protocol.inc + +--let $log_slow_prefix=log_slow_innodb + +# Force cold buffer pool +#--let $restart_parameters=--innodb_buffer_pool_load_at_startup=OFF +#--source include/restart_mysqld.inc + +CREATE TABLE t1(a INT primary key, b int) ENGINE=InnoDB; +INSERT INTO t1 select seq, seq from seq_1_to_1000; + +SET SESSION min_examined_row_limit=0; +SET SESSION long_query_time=0; + +# +# Test all enabled options with InnoDB-involving query +# +SET SESSION log_slow_verbosity='innodb,query_plan'; +--let log_file=$log_slow_prefix-verbosity_1 + +--source include/log_slow_start.inc +SELECT sum(a+b) FROM t1; +UPDATE t1 set b=b+1 where a=1 or a=999; +--source include/log_slow_stop.inc + +--let log_slow_verbosity_expected_matches= 3 +--let log_slow_verbosity_queryplan_matches= 1 +--let log_slow_verbosity_innodb_expected_matches= 2 +--let log_slow_verbosity_tmptable_expected_matches= 0 +--source include/log_slow_grep.inc + +# +# Test for "No InnoDB statistics available" in output when InnoDB stats are requested +# but the query does not involve InnoDB tables +# + +SET SESSION log_slow_verbosity='innodb,query_plan'; +--let log_file=$log_slow_prefix-verbosity_2 + +--source include/log_slow_start.inc +SELECT 1; +--source include/log_slow_stop.inc + +--let log_slow_verbosity_expected_matches= 2 +--let log_slow_verbosity_queryplan_matches= 1 +--let log_slow_verbosity_innodb_expected_matches= 0 +--source include/log_slow_grep.inc + +# +# Test 'query_plan' +# + +SET SESSION log_slow_verbosity='query_plan'; +let log_file=$log_slow_prefix-verbosity_3 + +--source include/log_slow_start.inc +INSERT INTO t1 VALUE(1000); +--source include/log_slow_stop.inc + +--let log_slow_verbosity_innodb_expected_matches= 1 +--source include/log_slow_grep.inc + +DROP TABLE t1; +--source include/log_slow_cleanup.inc diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index dbb4fbc262d..c90db85efca 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -550,7 +550,7 @@ The following specify which files/extra groups are read (specified before remain (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 + innodb, query_plan, explain, engine, full --log-tc=name Path to transaction coordinator log (used for transactions that affect more than one storage engine, when binary log is disabled). diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test index b60cb95fcd6..fe6937f4de6 100644 --- a/mysql-test/main/opt_trace.test +++ b/mysql-test/main/opt_trace.test @@ -1,5 +1,8 @@ --source include/not_embedded.inc --source include/have_sequence.inc +# View protocol changes some plans +--source include/no_view_protocol.inc + SELECT table_name, column_name FROM information_schema.columns where table_name="OPTIMIZER_TRACE"; set optimizer_trace="enabled=on"; show variables like 'optimizer_trace'; diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result index a6d148679b6..274f29e34dc 100644 --- a/mysql-test/main/order_by.result +++ b/mysql-test/main/order_by.result @@ -1594,6 +1594,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 50, "r_filtered": 100, "attached_condition": "t1.c = 10 or t1.c is null", @@ -3483,6 +3484,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -3835,6 +3837,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -4004,6 +4007,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -4056,6 +4060,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -4114,6 +4119,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -4186,6 +4192,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -4361,6 +4368,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -4397,6 +4405,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 2, "attached_condition": "t1.b = t2.b" diff --git a/mysql-test/main/order_by_pack_big.result b/mysql-test/main/order_by_pack_big.result index 09b4b729de1..f7b9deeb312 100644 --- a/mysql-test/main/order_by_pack_big.result +++ b/mysql-test/main/order_by_pack_big.result @@ -119,6 +119,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -287,6 +288,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -451,6 +453,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -510,6 +513,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } diff --git a/mysql-test/main/partition_charset.result b/mysql-test/main/partition_charset.result index a0019dd8fc3..d9e496c475e 100644 --- a/mysql-test/main/partition_charset.result +++ b/mysql-test/main/partition_charset.result @@ -39,5 +39,17 @@ t1 CREATE TABLE `t1` ( (PARTITION `p0` VALUES LESS THAN ('a') ENGINE = MyISAM) DROP TABLE t1; # +# MDEV-30681 SIGFPE / UBSAN runtime error: division by zero in String::needs_conversion on ALTER +# +CREATE TABLE t1 (a BINARY (10)) PARTITION BY LIST COLUMNS (a) (PARTITION p VALUES IN (0xFF)); +SELECT COLUMN_TYPE, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1'; +COLUMN_TYPE COLLATION_NAME +binary(10) NULL +ALTER TABLE t1 CHANGE COLUMN a a CHAR(10) BINARY; +SELECT COLUMN_TYPE, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1'; +COLUMN_TYPE COLLATION_NAME +char(10) latin1_bin +DROP TABLE t1; +# # End of 10.9 tests # diff --git a/mysql-test/main/partition_charset.test b/mysql-test/main/partition_charset.test index b8a17ce4fca..87aa42b4f7c 100644 --- a/mysql-test/main/partition_charset.test +++ b/mysql-test/main/partition_charset.test @@ -43,6 +43,17 @@ ALTER TABLE t1 CHANGE COLUMN a a CHAR BINARY; SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # MDEV-30681 SIGFPE / UBSAN runtime error: division by zero in String::needs_conversion on ALTER +--echo # + +CREATE TABLE t1 (a BINARY (10)) PARTITION BY LIST COLUMNS (a) (PARTITION p VALUES IN (0xFF)); +SELECT COLUMN_TYPE, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1'; +ALTER TABLE t1 CHANGE COLUMN a a CHAR(10) BINARY; +SELECT COLUMN_TYPE, COLLATION_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1'; +DROP TABLE t1; + + --echo # --echo # End of 10.9 tests --echo # diff --git a/mysql-test/main/rowid_filter.result b/mysql-test/main/rowid_filter.result index b544c784c25..11f92f5b6dd 100644 --- a/mysql-test/main/rowid_filter.result +++ b/mysql-test/main/rowid_filter.result @@ -153,6 +153,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.476269722, "r_filtered": 100, "index_condition": "lineitem.l_quantity > 47", @@ -267,6 +268,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.476269722, "r_filtered": 9.742120344, "index_condition": "lineitem.l_quantity > 47", @@ -415,6 +417,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "index_condition": "orders.o_totalprice between 200000 and 230000" @@ -454,6 +457,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 1.631973386, "r_filtered": 100, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'" @@ -576,6 +580,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'" @@ -598,6 +603,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 4.599999905, "r_filtered": 11.2244898, "attached_condition": "orders.o_totalprice between 200000 and 230000" @@ -756,6 +762,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.476269722, "r_filtered": 100, "index_condition": "lineitem.l_quantity > 47", @@ -791,6 +798,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 9.266666412, "r_filtered": 100, "attached_condition": "orders.o_totalprice between 180000 and 230000" @@ -919,6 +927,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.476269722, "r_filtered": 9.742120344, "index_condition": "lineitem.l_quantity > 47", @@ -941,6 +950,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 9.266666412, "r_filtered": 26.47058824, "attached_condition": "orders.o_totalprice between 180000 and 230000" @@ -1073,6 +1083,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "index_condition": "orders.o_totalprice between 200000 and 230000" @@ -1112,6 +1123,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.476269722, "r_filtered": 100, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'" @@ -1255,6 +1267,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "index_condition": "orders.o_totalprice between 200000 and 230000" @@ -1281,6 +1294,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.476269722, "r_filtered": 7.773109244, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'" @@ -1447,6 +1461,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 0.566194832, "r_filtered": 38.88888889, "index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'", @@ -1469,6 +1484,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 7.466666698, "r_filtered": 14.28571429, "attached_condition": "orders.o_totalprice between 200000 and 250000" @@ -1594,6 +1610,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 0.566194832, "r_filtered": 38.88888889, "index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'", @@ -1616,6 +1633,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 7.466666698, "r_filtered": 14.28571429, "attached_condition": "orders.o_totalprice between 200000 and 250000" @@ -1741,6 +1759,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 3.200000048, "r_filtered": 2.43902439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1768,6 +1787,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 3.047460556, "r_filtered": 66.66666667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -1889,6 +1909,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 3.200000048, "r_filtered": 2.43902439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1916,6 +1937,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 3.047460556, "r_filtered": 66.66666667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -2050,6 +2072,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": {}, "filtered": "REPLACED", "r_filtered": 2.43902439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -2077,6 +2100,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": {}, "filtered": "REPLACED", "r_filtered": 66.66666667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -2208,6 +2232,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": {}, "filtered": "REPLACED", "r_filtered": 2.43902439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -2235,6 +2260,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": {}, "filtered": "REPLACED", "r_filtered": 66.66666667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" diff --git a/mysql-test/main/rowid_filter_aria.result b/mysql-test/main/rowid_filter_aria.result index b7a3a29ab9c..aa31a247f5f 100644 --- a/mysql-test/main/rowid_filter_aria.result +++ b/mysql-test/main/rowid_filter_aria.result @@ -154,6 +154,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 11.80682755, "r_filtered": 100, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'", @@ -268,6 +269,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 11.80682755, "r_filtered": 6.666666667, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'", @@ -421,6 +423,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'" @@ -456,6 +459,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 7.066666603, "r_filtered": 100, "attached_condition": "orders.o_totalprice between 200000 and 230000" @@ -578,6 +582,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'" @@ -600,6 +605,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 7.066666603, "r_filtered": 11.2244898, "attached_condition": "orders.o_totalprice between 200000 and 230000" @@ -750,6 +756,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 11.80682755, "r_filtered": 100, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'", @@ -773,6 +780,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 14.39999962, "r_filtered": 26.47058824, "attached_condition": "orders.o_totalprice between 180000 and 230000" @@ -901,6 +909,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 11.80682755, "r_filtered": 6.666666667, "index_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'", @@ -924,6 +933,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 14.39999962, "r_filtered": 26.47058824, "attached_condition": "orders.o_totalprice between 180000 and 230000" @@ -1056,6 +1066,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "index_condition": "orders.o_totalprice between 200000 and 230000" @@ -1095,6 +1106,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.026644707, "r_filtered": 100, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'" @@ -1238,6 +1250,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "index_condition": "orders.o_totalprice between 200000 and 230000" @@ -1264,6 +1277,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.026644707, "r_filtered": 7.773109244, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'" @@ -1430,6 +1444,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 0.532889247, "r_filtered": 38.88888889, "index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'", @@ -1452,6 +1467,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.466666222, "r_filtered": 14.28571429, "attached_condition": "orders.o_totalprice between 200000 and 250000" @@ -1577,6 +1593,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 0.532889247, "r_filtered": 38.88888889, "index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'", @@ -1599,6 +1616,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.466666222, "r_filtered": 14.28571429, "attached_condition": "orders.o_totalprice between 200000 and 250000" @@ -1724,6 +1742,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 5, "r_filtered": 2.43902439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1751,6 +1770,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 2.897585392, "r_filtered": 66.66666667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -1872,6 +1892,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 5, "r_filtered": 2.43902439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1899,6 +1920,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 2.897585392, "r_filtered": 66.66666667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -2033,6 +2055,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": {}, "filtered": "REPLACED", "r_filtered": 2.43902439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -2060,6 +2083,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": {}, "filtered": "REPLACED", "r_filtered": 66.66666667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -2191,6 +2215,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": {}, "filtered": "REPLACED", "r_filtered": 2.43902439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -2218,6 +2243,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": {}, "filtered": "REPLACED", "r_filtered": 66.66666667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" diff --git a/mysql-test/main/rowid_filter_innodb.result b/mysql-test/main/rowid_filter_innodb.result index 5b8c56c87d3..d7946de7a7f 100644 --- a/mysql-test/main/rowid_filter_innodb.result +++ b/mysql-test/main/rowid_filter_innodb.result @@ -156,6 +156,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.492922783, "r_filtered": 100, "index_condition": "lineitem.l_quantity > 47", @@ -270,6 +271,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.492922783, "r_filtered": 9.742120344, "index_condition": "lineitem.l_quantity > 47", @@ -416,6 +418,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'", @@ -439,6 +442,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 4.733333111, "r_filtered": 11.2244898, "attached_condition": "orders.o_totalprice between 200000 and 230000" @@ -562,6 +566,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-01-31'", @@ -585,6 +590,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 4.733333111, "r_filtered": 11.2244898, "attached_condition": "orders.o_totalprice between 200000 and 230000" @@ -735,6 +741,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.492922783, "r_filtered": 100, "index_condition": "lineitem.l_quantity > 47", @@ -757,6 +764,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 9.600000381, "r_filtered": 26.47058824, "attached_condition": "orders.o_totalprice between 180000 and 230000" @@ -879,6 +887,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "orders.o_totalprice between 180000 and 230000", @@ -907,6 +916,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 0.493593663, "r_filtered": 0.943396226, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30' and lineitem.l_quantity > 47" @@ -1032,6 +1042,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "orders.o_totalprice between 200000 and 230000", @@ -1059,6 +1070,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.492922783, "r_filtered": 7.773109244, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'" @@ -1203,6 +1215,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "orders.o_totalprice between 200000 and 230000", @@ -1230,6 +1243,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.492922783, "r_filtered": 7.773109244, "attached_condition": "lineitem.l_shipDATE between '1997-01-01' and '1997-06-30'" @@ -1396,6 +1410,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 0.566194832, "r_filtered": 38.88888889, "index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'", @@ -1418,6 +1433,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 5.666666508, "r_filtered": 14.28571429, "attached_condition": "orders.o_totalprice between 200000 and 250000" @@ -1543,6 +1559,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 0.566194832, "r_filtered": 38.88888889, "index_condition": "lineitem.l_receiptDATE between '1996-10-05' and '1996-10-10'", @@ -1565,6 +1582,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 5.666666508, "r_filtered": 14.28571429, "attached_condition": "orders.o_totalprice between 200000 and 250000" @@ -1690,6 +1708,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 3.333333254, "r_filtered": 2.43902439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1717,6 +1736,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 3.047460556, "r_filtered": 66.66666667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -1838,6 +1858,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 3.333333254, "r_filtered": 2.43902439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -1865,6 +1886,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 3.047460556, "r_filtered": 66.66666667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -1999,6 +2021,9 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": { + "pages_accessed": 84 + }, "filtered": "REPLACED", "r_filtered": 2.43902439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -2026,6 +2051,9 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": { + "pages_accessed": 3 + }, "filtered": "REPLACED", "r_filtered": 66.66666667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -2157,6 +2185,9 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": { + "pages_accessed": 84 + }, "filtered": "REPLACED", "r_filtered": 2.43902439, "index_condition": "orders.o_totaldiscount between 18000 and 20000", @@ -2184,6 +2215,9 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": { + "pages_accessed": 3 + }, "filtered": "REPLACED", "r_filtered": 66.66666667, "attached_condition": "lineitem.l_shipDATE between '1996-10-01' and '1996-12-01'" @@ -3311,6 +3345,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100, "attached_condition": "t.tp = 121 and t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2'", @@ -3334,6 +3369,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 }, @@ -3379,6 +3415,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 14.46428585, "r_filtered": 100 }, diff --git a/mysql-test/main/rowid_filter_myisam.result b/mysql-test/main/rowid_filter_myisam.result index 315eb75afc1..ecc6a9f3186 100644 --- a/mysql-test/main/rowid_filter_myisam.result +++ b/mysql-test/main/rowid_filter_myisam.result @@ -358,6 +358,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 49.20000076, "r_filtered": 100, "index_condition": "t1.nm like '500%'", @@ -414,6 +415,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 49.20000076, "r_filtered": 100, "index_condition": "t1.nm like '500%'", @@ -509,6 +511,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 1.149999976, "r_filtered": 100, "attached_condition": "t1.nm like '75%'" @@ -612,6 +615,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.630000114, "r_filtered": 0, "index_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%'", @@ -668,6 +672,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 8.529999733, "r_filtered": 100, "index_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%'", diff --git a/mysql-test/main/show_analyze.result b/mysql-test/main/show_analyze.result index 2cc18e40d94..f1d478cc8a7 100644 --- a/mysql-test/main/show_analyze.result +++ b/mysql-test/main/show_analyze.result @@ -429,6 +429,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } diff --git a/mysql-test/main/show_analyze_json.result b/mysql-test/main/show_analyze_json.result index 87f2ea9a655..aa14c4cbb63 100644 --- a/mysql-test/main/show_analyze_json.result +++ b/mysql-test/main/show_analyze_json.result @@ -133,6 +133,7 @@ SHOW ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 99.90000153, "r_filtered": 100, "attached_condition": "t1.a < 10" @@ -335,6 +336,7 @@ SHOW ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 60, "attached_condition": "a.a <= 5" @@ -358,6 +360,7 @@ SHOW ANALYZE "rows": 10, "r_rows": null, "cost": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": null, "attached_condition": "b.a >= 9" @@ -413,6 +416,7 @@ SHOW ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 60, "attached_condition": "a.a <= 5" @@ -440,6 +444,7 @@ SHOW ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 10, "attached_condition": "b.a >= 9" @@ -555,6 +560,7 @@ SHOW ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 20, "attached_condition": "a.a < 2" @@ -580,6 +586,7 @@ SHOW ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 30, "attached_condition": "b.a > 6" @@ -765,6 +772,7 @@ SHOW ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 20, "attached_condition": "a.a < 2" @@ -793,6 +801,7 @@ SHOW ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 95, "attached_condition": "b.a + a.a < 10" diff --git a/mysql-test/main/sp-memory-leak.result b/mysql-test/main/sp-memory-leak.result new file mode 100644 index 00000000000..37a0f119341 --- /dev/null +++ b/mysql-test/main/sp-memory-leak.result @@ -0,0 +1,42 @@ +# +# MDEV-30680 Warning: Memory not freed: 280 on mangled query, LeakSanitizer: detected memory leaks +# +BEGIN NOT ATOMIC +IF SCALAR() expected_THEN_here; +END +$$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'expected_THEN_here; +END' at line 2 +BEGIN NOT ATOMIC +WHILE SCALAR() expected_DO_here; +END +$$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'expected_DO_here; +END' at line 2 +BEGIN NOT ATOMIC +REPEAT SELECT 1; UNTIL SCALAR() expected_END_here; +END +$$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'expected_END_here; +END' at line 2 +# +# MDEV-31578 DECLARE CURSOR: "Memory not freed: 280 bytes lost" on syntax error +# +BEGIN NOT ATOMIC +DECLARE cur CURSOR (a INT) FOR SELECT a+1; +OPEN cur(sp_followed_by_syntax_error(); +CLOSE cur; +END; +$$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '; +CLOSE cur; +END' at line 3 +BEGIN NOT ATOMIC +DECLARE cur CURSOR (a INT) FOR SELECT a+1; +OPEN cur(1,sp_followed_by_syntax_error(); +CLOSE cur; +END; +$$ +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '; +CLOSE cur; +END' at line 3 diff --git a/mysql-test/main/sp-memory-leak.test b/mysql-test/main/sp-memory-leak.test new file mode 100644 index 00000000000..0035044209a --- /dev/null +++ b/mysql-test/main/sp-memory-leak.test @@ -0,0 +1,54 @@ +--echo # +--echo # MDEV-30680 Warning: Memory not freed: 280 on mangled query, LeakSanitizer: detected memory leaks +--echo # + +DELIMITER $$; +--error ER_PARSE_ERROR +BEGIN NOT ATOMIC + IF SCALAR() expected_THEN_here; +END +$$ +DELIMITER ;$$ + + +DELIMITER $$; +--error ER_PARSE_ERROR +BEGIN NOT ATOMIC + WHILE SCALAR() expected_DO_here; +END +$$ +DELIMITER ;$$ + + +DELIMITER $$; +--error ER_PARSE_ERROR +BEGIN NOT ATOMIC + REPEAT SELECT 1; UNTIL SCALAR() expected_END_here; +END +$$ +DELIMITER ;$$ + + +--echo # +--echo # MDEV-31578 DECLARE CURSOR: "Memory not freed: 280 bytes lost" on syntax error +--echo # + +DELIMITER $$; +--error ER_PARSE_ERROR +BEGIN NOT ATOMIC + DECLARE cur CURSOR (a INT) FOR SELECT a+1; + OPEN cur(sp_followed_by_syntax_error(); + CLOSE cur; +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +--error ER_PARSE_ERROR +BEGIN NOT ATOMIC + DECLARE cur CURSOR (a INT) FOR SELECT a+1; + OPEN cur(1,sp_followed_by_syntax_error(); + CLOSE cur; +END; +$$ +DELIMITER ;$$ diff --git a/mysql-test/main/subselect3.result b/mysql-test/main/subselect3.result index c9a1ea6ca61..0504a9ab39c 100644 --- a/mysql-test/main/subselect3.result +++ b/mysql-test/main/subselect3.result @@ -62,7 +62,7 @@ a in (select max(ie) from t1 where oref=4 group by grp) 0 show status like 'Handler_read_rnd_next'; Variable_name Value -Handler_read_rnd_next 11 +Handler_read_rnd_next 19 select ' ^ This must show 11' Z; Z ^ This must show 11 diff --git a/mysql-test/main/subselect3_jcl6.result b/mysql-test/main/subselect3_jcl6.result index ca06d25db49..81e3d135ad3 100644 --- a/mysql-test/main/subselect3_jcl6.result +++ b/mysql-test/main/subselect3_jcl6.result @@ -65,7 +65,7 @@ a in (select max(ie) from t1 where oref=4 group by grp) 0 show status like 'Handler_read_rnd_next'; Variable_name Value -Handler_read_rnd_next 11 +Handler_read_rnd_next 19 select ' ^ This must show 11' Z; Z ^ This must show 11 diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result index 423a0777d5e..6be70feb2df 100644 --- a/mysql-test/main/subselect4.result +++ b/mysql-test/main/subselect4.result @@ -2944,6 +2944,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -2971,6 +2972,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 50, "attached_condition": "((t1.b,(subquery#3) >= 4))" @@ -2996,6 +2998,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } diff --git a/mysql-test/main/subselect_cache.result b/mysql-test/main/subselect_cache.result index 10bb54cbb14..97c4ef04a11 100644 --- a/mysql-test/main/subselect_cache.result +++ b/mysql-test/main/subselect_cache.result @@ -64,6 +64,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -91,6 +92,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 18.75, "attached_condition": "t1.b = t2.c" @@ -127,6 +129,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } @@ -162,6 +165,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 18.75, "attached_condition": "t1.b = t2.c" @@ -205,6 +209,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 18.75, "attached_condition": "t1.b = t2.c" @@ -1734,7 +1739,7 @@ Subquery_cache_miss 18 show status like '%Handler_read%'; Variable_name Value Handler_read_first 0 -Handler_read_key 32 +Handler_read_key 29 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 @@ -1799,7 +1804,7 @@ Subquery_cache_miss 10 show status like '%Handler_read%'; Variable_name Value Handler_read_first 0 -Handler_read_key 13 +Handler_read_key 12 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 diff --git a/mysql-test/main/type_json.result b/mysql-test/main/type_json.result index 681bd42c4e3..431a7f138f6 100644 --- a/mysql-test/main/type_json.result +++ b/mysql-test/main/type_json.result @@ -159,5 +159,23 @@ def j 250 (format=json) 9437283 16 Y 0 39 33 j {"a": {"b":"c"}} # +# MDEV-26506 Over-quoted JSON when combining JSON_ARRAYAGG with JSON_OBJECT +# +# maintain JSON property through internal temporary tables +create table t1 (a varchar(30)); +insert into t1 values ('root'); +select json_object('attr2',o) from (select a, json_arrayagg(json_object('attr1', a)) as o from t1) u; +json_object('attr2',o) +{"attr2": [{"attr1": "root"}]} +drop table t1; +create view v1 as select json_object(_latin1 'a', _latin1'b') as v1_json; +select v1_json from v1; +v1_json +{"a": "b"} +select json_arrayagg(v1_json) from v1; +json_arrayagg(v1_json) +[{"a": "b"}] +drop view v1; +# # End of 10.5 tests # diff --git a/mysql-test/main/type_json.test b/mysql-test/main/type_json.test index 38754ba6e1e..8effe78f803 100644 --- a/mysql-test/main/type_json.test +++ b/mysql-test/main/type_json.test @@ -121,6 +121,20 @@ SELECT json_object('a', (SELECT json_objectagg(b, c) FROM (SELECT 'b','c') d)) A --disable_ps_protocol --enable_view_protocol +--echo # +--echo # MDEV-26506 Over-quoted JSON when combining JSON_ARRAYAGG with JSON_OBJECT +--echo # +--echo # maintain JSON property through internal temporary tables +create table t1 (a varchar(30)); +insert into t1 values ('root'); +select json_object('attr2',o) from (select a, json_arrayagg(json_object('attr1', a)) as o from t1) u; +drop table t1; + +create view v1 as select json_object(_latin1 'a', _latin1'b') as v1_json; +select v1_json from v1; +select json_arrayagg(v1_json) from v1; +drop view v1; + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index e8d24994140..3363e77ea6e 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -3893,6 +3893,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } diff --git a/mysql-test/suite/compat/oracle/r/func_to_char.result b/mysql-test/suite/compat/oracle/r/func_to_char.result index a4978b07579..1f95acece5e 100644 --- a/mysql-test/suite/compat/oracle/r/func_to_char.result +++ b/mysql-test/suite/compat/oracle/r/func_to_char.result @@ -439,3 +439,10 @@ NULL 2021-01-24 drop table t1,t2; set @local.sql_mode=@sql_mode; +# +# MDEV-29152: Assertion failed ... upon TO_CHAR with wrong argument +# +SELECT TO_CHAR((VALUES('2022-12-12','2020-10-10'))); +ERROR HY000: Illegal parameter data type row for operation 'to_char' +SELECT TO_CHAR((STR_TO_DATE('2023-01-01', '%d-%m-%Y'), 'YYYY-MM-DD') ); +ERROR HY000: Illegal parameter data type row for operation 'to_char' diff --git a/mysql-test/suite/compat/oracle/t/func_to_char.test b/mysql-test/suite/compat/oracle/t/func_to_char.test index 9910fe60a84..7a40321538d 100644 --- a/mysql-test/suite/compat/oracle/t/func_to_char.test +++ b/mysql-test/suite/compat/oracle/t/func_to_char.test @@ -224,3 +224,13 @@ select * from t2; drop table t1,t2; set @local.sql_mode=@sql_mode; +--echo # +--echo # MDEV-29152: Assertion failed ... upon TO_CHAR with wrong argument +--echo # + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT TO_CHAR((VALUES('2022-12-12','2020-10-10'))); + +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +SELECT TO_CHAR((STR_TO_DATE('2023-01-01', '%d-%m-%Y'), 'YYYY-MM-DD') ); + diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result index 5654946d786..39d10000717 100644 --- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result +++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result @@ -3899,6 +3899,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } diff --git a/mysql-test/suite/federated/federatedx_create_handlers.result b/mysql-test/suite/federated/federatedx_create_handlers.result index e4e7a8a3679..a89bb034709 100644 --- a/mysql-test/suite/federated/federatedx_create_handlers.result +++ b/mysql-test/suite/federated/federatedx_create_handlers.result @@ -251,6 +251,7 @@ ANALYZE "cost": "REPLACED", "r_table_time_ms": "REPLACED", "r_other_time_ms": "REPLACED", + "r_engine_stats": REPLACED, "filtered": 100, "r_filtered": 100 } diff --git a/mysql-test/suite/innodb/r/innodb_row_lock_time_ms.result b/mysql-test/suite/innodb/r/innodb_row_lock_time_ms.result new file mode 100644 index 00000000000..984d789e058 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb_row_lock_time_ms.result @@ -0,0 +1,40 @@ +CREATE TABLE `t`(`id` INT, PRIMARY KEY(`id`)) ENGINE=InnoDB STATS_PERSISTENT=0; +INSERT INTO t VALUES (1); +SET GLOBAL innodb_monitor_reset = "module_innodb"; +BEGIN; +SELECT * FROM t FOR UPDATE; +id +1 +connect con1,localhost,root,,; +SET innodb_lock_wait_timeout = 1; +SELECT * FROM t FOR UPDATE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +disconnect con1; +connection default; +COMMIT; +SELECT variable_value > 100 FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_row_lock_time'; +variable_value > 100 +1 +SELECT variable_value > 100 FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_row_lock_time_max'; +variable_value > 100 +1 +SELECT variable_value > 100 FROM information_schema.global_status +WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'; +variable_value > 100 +1 +SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS +WHERE NAME="lock_row_lock_time"; +count_reset > 100 +1 +SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS +WHERE NAME="lock_row_lock_time_max"; +count_reset > 100 +1 +SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS +WHERE NAME="lock_row_lock_time_avg"; +count_reset > 100 +1 +DROP TABLE t; +SET GLOBAL innodb_monitor_reset=default; diff --git a/mysql-test/suite/innodb/t/innodb_row_lock_time_ms.test b/mysql-test/suite/innodb/t/innodb_row_lock_time_ms.test new file mode 100644 index 00000000000..4a100821819 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_row_lock_time_ms.test @@ -0,0 +1,42 @@ +--source include/have_innodb.inc +--source include/count_sessions.inc + +CREATE TABLE `t`(`id` INT, PRIMARY KEY(`id`)) ENGINE=InnoDB STATS_PERSISTENT=0; + +INSERT INTO t VALUES (1); + +SET GLOBAL innodb_monitor_reset = "module_innodb"; + +BEGIN; +SELECT * FROM t FOR UPDATE; + +--connect(con1,localhost,root,,) +SET innodb_lock_wait_timeout = 1; +--error ER_LOCK_WAIT_TIMEOUT +SELECT * FROM t FOR UPDATE; +--disconnect con1 + +--connection default +COMMIT; + +SELECT variable_value > 100 FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_row_lock_time'; +SELECT variable_value > 100 FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_row_lock_time_max'; +SELECT variable_value > 100 FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'; + +SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS + WHERE NAME="lock_row_lock_time"; +SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS + WHERE NAME="lock_row_lock_time_max"; +SELECT count_reset > 100 FROM INFORMATION_SCHEMA.INNODB_METRICS + WHERE NAME="lock_row_lock_time_avg"; + +DROP TABLE t; + +--disable_warnings +SET GLOBAL innodb_monitor_reset=default; +--enable_warnings + +--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 f54aebf317e..7c39ce02228 100644 --- a/mysql-test/suite/innodb/t/log_corruption.test +++ b/mysql-test/suite/innodb/t/log_corruption.test @@ -599,11 +599,11 @@ print OUT pack("x[470]N", 0x677700cf); # invalid (all-zero) checkpoint page 1 and an empty log page print OUT chr(0) x 1024; # valid checkpoint block 2 -print OUT pack("x[12]NNNx[264]", 0x12860c, 0, 0x80c); +print OUT pack("x[12]NNNx[264]", 0x12860c, 0, 0x120c); # pointer to the FILE_CHECKPOINT record, and checkpoint page checksum -print OUT pack("H*x[204]NNN", "590DBAACFE922582", 0x128612, 0, 0x101741b); +print OUT pack("H*x[204]NNN", "590DBAACFE922582", 0x128612, 0, 0x3b4ce62d); # log page -print OUT pack("NnnNx[496]N", 0x80000944, 12, 12, 1, 0x46c8a2a2); +print OUT pack("x[2560]NnnNx[496]N", 0x80000944, 12, 12, 1, 0x46c8a2a2); close OUT or die; EOF 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 88d3bb1789e..910162c7446 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -1769,7 +1769,7 @@ VARIABLE_COMMENT Verbosity level for the slow log NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST innodb,query_plan,explain +ENUM_VALUE_LIST innodb,query_plan,explain,engine,full READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME LOG_WARNINGS 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 a37735fa769..51ee122a646 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -1919,7 +1919,7 @@ VARIABLE_COMMENT Verbosity level for the slow log NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST innodb,query_plan,explain +ENUM_VALUE_LIST innodb,query_plan,explain,engine,full READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME LOG_WARNINGS diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index fd8a99c2196..2e8decd7d06 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -23,7 +23,7 @@ #include #include -pthread_key(struct st_my_thread_var*, THR_KEY_mysys); +pthread_key(struct st_my_thread_var*, THR_KEY_mysys=-1); mysql_mutex_t THR_LOCK_malloc, THR_LOCK_open, THR_LOCK_lock, THR_LOCK_myisam, THR_LOCK_heap, THR_LOCK_net, THR_LOCK_charset, THR_LOCK_threads, diff --git a/plugin/type_inet/item_inetfunc.cc b/plugin/type_inet/item_inetfunc.cc index 514a3760cd5..1551b53b695 100644 --- a/plugin/type_inet/item_inetfunc.cc +++ b/plugin/type_inet/item_inetfunc.cc @@ -151,14 +151,14 @@ String *Item_func_inet6_aton::val_str(String *buffer) if ((null_value= tmp.is_null())) return NULL; - Inet4Bundle::Fbt_null ipv4(*tmp.string()); + Type_handler_inet4::Fbt_null ipv4(*tmp.string()); if (!ipv4.is_null()) { ipv4.to_binary(buffer); return buffer; } - Inet6Bundle::Fbt_null ipv6(*tmp.string()); + Type_handler_inet6::Fbt_null ipv6(*tmp.string()); if (!ipv6.is_null()) { ipv6.to_binary(buffer); @@ -190,14 +190,14 @@ String *Item_func_inet6_ntoa::val_str_ascii(String *buffer) if ((null_value= tmp.is_null())) return NULL; - Inet4Bundle::Fbt_null ipv4(static_cast(*tmp.string())); + Type_handler_inet4::Fbt_null ipv4(static_cast(*tmp.string())); if (!ipv4.is_null()) { ipv4.to_string(buffer); return buffer; } - Inet6Bundle::Fbt_null ipv6(static_cast(*tmp.string())); + Type_handler_inet6::Fbt_null ipv6(static_cast(*tmp.string())); if (!ipv6.is_null()) { ipv6.to_string(buffer); @@ -218,13 +218,13 @@ longlong Item_func_is_ipv4::val_int() { DBUG_ASSERT(fixed()); String_ptr_and_buffer tmp(args[0]); - return !tmp.is_null() && !Inet4Bundle::Fbt_null(*tmp.string()).is_null(); + return !tmp.is_null() && !Type_handler_inet4::Fbt_null(*tmp.string()).is_null(); } -class IP6 : public Inet6Bundle::Fbt_null +class IP6 : public Type_handler_inet6::Fbt_null { public: - IP6(Item* arg) : Inet6Bundle::Fbt_null(arg) {} + IP6(Item* arg) : Type_handler_inet6::Fbt_null(arg) {} bool is_v4compat() const { static_assert(sizeof(in6_addr) == IN6_ADDR_SIZE, "unexpected in6_addr size"); @@ -246,7 +246,7 @@ longlong Item_func_is_ipv6::val_int() { DBUG_ASSERT(fixed()); String_ptr_and_buffer tmp(args[0]); - return !tmp.is_null() && !Inet6Bundle::Fbt_null(*tmp.string()).is_null(); + return !tmp.is_null() && !Type_handler_inet6::Fbt_null(*tmp.string()).is_null(); } /** diff --git a/plugin/type_inet/plugin.cc b/plugin/type_inet/plugin.cc index e2854314ac0..7a69d23b455 100644 --- a/plugin/type_inet/plugin.cc +++ b/plugin/type_inet/plugin.cc @@ -24,14 +24,14 @@ static struct st_mariadb_data_type plugin_descriptor_type_inet4= { MariaDB_DATA_TYPE_INTERFACE_VERSION, - Inet4Bundle::type_handler_fbt() + Type_handler_inet4::singleton() }; static struct st_mariadb_data_type plugin_descriptor_type_inet6= { MariaDB_DATA_TYPE_INTERFACE_VERSION, - Inet6Bundle::type_handler_fbt() + Type_handler_inet6::singleton() }; diff --git a/plugin/type_inet/sql_type_inet.cc b/plugin/type_inet/sql_type_inet.cc index 3d499620780..03c8d8133e5 100644 --- a/plugin/type_inet/sql_type_inet.cc +++ b/plugin/type_inet/sql_type_inet.cc @@ -259,9 +259,9 @@ bool Inet6::ascii_to_fbt(const char *str, size_t str_length) return true; } - Inet4Bundle::Fbt_null tmp(group_start_ptr, - (size_t) (str_end - group_start_ptr), - &my_charset_latin1); + Type_handler_inet4::Fbt_null tmp(group_start_ptr, + (size_t) (str_end - group_start_ptr), + &my_charset_latin1); if (tmp.is_null()) { DBUG_PRINT("error", ("ascii_to_ipv6(%.*s): invalid IPv6 address: " diff --git a/plugin/type_inet/sql_type_inet.h b/plugin/type_inet/sql_type_inet.h index 3ea06f6600c..bb14dab1dc2 100644 --- a/plugin/type_inet/sql_type_inet.h +++ b/plugin/type_inet/sql_type_inet.h @@ -44,7 +44,7 @@ public: #include "sql_type_fixedbin.h" -typedef FixedBinTypeBundle Inet6Bundle; +typedef Type_handler_fbt Type_handler_inet6; /***********************************************************************/ @@ -57,7 +57,7 @@ public: static const Name &default_value(); }; -typedef FixedBinTypeBundle Inet4Bundle; +typedef Type_handler_fbt Type_handler_inet4; #endif /* SQL_TYPE_INET_H */ diff --git a/plugin/type_mysql_json/type.cc b/plugin/type_mysql_json/type.cc index b897f64a3b2..a39c4ad2006 100644 --- a/plugin/type_mysql_json/type.cc +++ b/plugin/type_mysql_json/type.cc @@ -188,13 +188,6 @@ public: { return NULL; } - - const Type_handler *handler_by_name(const LEX_CSTRING &name) const override - { - if (type_handler_mysql_json.name().eq(name)) - return &type_handler_mysql_json; - return NULL; - } }; const Type_collection *Type_handler_mysql_json::type_collection() const diff --git a/plugin/type_mysql_timestamp/plugin.cc b/plugin/type_mysql_timestamp/plugin.cc index fd6ad896aa7..a524c5c0124 100644 --- a/plugin/type_mysql_timestamp/plugin.cc +++ b/plugin/type_mysql_timestamp/plugin.cc @@ -26,11 +26,6 @@ protected: const Type_handler *aggregate_common(const Type_handler *h1, const Type_handler *h2) const; public: - const Type_handler *handler_by_name(const LEX_CSTRING &name) const override - { - return NULL; - } - const Type_handler *aggregate_for_result(const Type_handler *h1, const Type_handler *h2) const override diff --git a/plugin/type_test/plugin.cc b/plugin/type_test/plugin.cc index 4c26c35f976..a649ebb3e41 100644 --- a/plugin/type_test/plugin.cc +++ b/plugin/type_test/plugin.cc @@ -26,10 +26,6 @@ protected: const Type_handler *aggregate_common(const Type_handler *h1, const Type_handler *h2) const; public: - const Type_handler *handler_by_name(const LEX_CSTRING &name) const override - { - return NULL; - } const Type_handler *aggregate_for_result(const Type_handler *h1, const Type_handler *h2) const override; diff --git a/plugin/type_uuid/CMakeLists.txt b/plugin/type_uuid/CMakeLists.txt index 9a379abef04..6b0d6a458bf 100644 --- a/plugin/type_uuid/CMakeLists.txt +++ b/plugin/type_uuid/CMakeLists.txt @@ -14,5 +14,5 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA MYSQL_ADD_PLUGIN(type_uuid - plugin.cc sql_type_uuid.cc item_uuidfunc.cc + plugin.cc item_uuidfunc.cc MANDATORY RECOMPILE_FOR_EMBEDDED) diff --git a/plugin/type_uuid/item_uuidfunc.cc b/plugin/type_uuid/item_uuidfunc.cc index 725b696f905..3f2b7434f73 100644 --- a/plugin/type_uuid/item_uuidfunc.cc +++ b/plugin/type_uuid/item_uuidfunc.cc @@ -33,7 +33,7 @@ String *Item_func_sys_guid::val_str(String *str) const Type_handler *Item_func_uuid::type_handler() const { - return UUIDBundle::type_handler_fbt(); + return Type_handler_uuid_new::singleton(); } bool Item_func_uuid::val_native(THD *, Native *to) diff --git a/plugin/type_uuid/mysql-test/type_uuid/order.result b/plugin/type_uuid/mysql-test/type_uuid/order.result new file mode 100644 index 00000000000..2f6ae3ed47c --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/order.result @@ -0,0 +1,768 @@ +create table t1 (a uuid, b int not null, index (a)); +insert t1 select sformat('11223344-5566-{:x}777-{}888-99aabbccddee', seq div 4, elt(1+(seq % 4),0,8,'c','e')),seq from seq_0_to_63; +Warnings: +Warning 1292 Incorrect uuid value: '11223344-5566-8777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 33 +Warning 1292 Incorrect uuid value: '11223344-5566-9777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 37 +Warning 1292 Incorrect uuid value: '11223344-5566-a777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 41 +Warning 1292 Incorrect uuid value: '11223344-5566-b777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 45 +Warning 1292 Incorrect uuid value: '11223344-5566-c777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 49 +Warning 1292 Incorrect uuid value: '11223344-5566-d777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 53 +Warning 1292 Incorrect uuid value: '11223344-5566-e777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 57 +Warning 1292 Incorrect uuid value: '11223344-5566-f777-0888-99aabbccddee' for column `test`.`t1`.`a` at row 61 +select * from t1; +a b +11223344-5566-0777-0888-99aabbccddee 0 +11223344-5566-0777-8888-99aabbccddee 1 +11223344-5566-0777-c888-99aabbccddee 2 +11223344-5566-0777-e888-99aabbccddee 3 +11223344-5566-1777-0888-99aabbccddee 4 +11223344-5566-1777-8888-99aabbccddee 5 +11223344-5566-1777-c888-99aabbccddee 6 +11223344-5566-1777-e888-99aabbccddee 7 +11223344-5566-2777-0888-99aabbccddee 8 +11223344-5566-2777-8888-99aabbccddee 9 +11223344-5566-2777-c888-99aabbccddee 10 +11223344-5566-2777-e888-99aabbccddee 11 +11223344-5566-3777-0888-99aabbccddee 12 +11223344-5566-3777-8888-99aabbccddee 13 +11223344-5566-3777-c888-99aabbccddee 14 +11223344-5566-3777-e888-99aabbccddee 15 +11223344-5566-4777-0888-99aabbccddee 16 +11223344-5566-4777-8888-99aabbccddee 17 +11223344-5566-4777-c888-99aabbccddee 18 +11223344-5566-4777-e888-99aabbccddee 19 +11223344-5566-5777-0888-99aabbccddee 20 +11223344-5566-5777-8888-99aabbccddee 21 +11223344-5566-5777-c888-99aabbccddee 22 +11223344-5566-5777-e888-99aabbccddee 23 +11223344-5566-6777-0888-99aabbccddee 24 +11223344-5566-6777-8888-99aabbccddee 25 +11223344-5566-6777-c888-99aabbccddee 26 +11223344-5566-6777-e888-99aabbccddee 27 +11223344-5566-7777-0888-99aabbccddee 28 +11223344-5566-7777-8888-99aabbccddee 29 +11223344-5566-7777-c888-99aabbccddee 30 +11223344-5566-7777-e888-99aabbccddee 31 +NULL 32 +11223344-5566-8777-8888-99aabbccddee 33 +11223344-5566-8777-c888-99aabbccddee 34 +11223344-5566-8777-e888-99aabbccddee 35 +NULL 36 +11223344-5566-9777-8888-99aabbccddee 37 +11223344-5566-9777-c888-99aabbccddee 38 +11223344-5566-9777-e888-99aabbccddee 39 +NULL 40 +11223344-5566-a777-8888-99aabbccddee 41 +11223344-5566-a777-c888-99aabbccddee 42 +11223344-5566-a777-e888-99aabbccddee 43 +NULL 44 +11223344-5566-b777-8888-99aabbccddee 45 +11223344-5566-b777-c888-99aabbccddee 46 +11223344-5566-b777-e888-99aabbccddee 47 +NULL 48 +11223344-5566-c777-8888-99aabbccddee 49 +11223344-5566-c777-c888-99aabbccddee 50 +11223344-5566-c777-e888-99aabbccddee 51 +NULL 52 +11223344-5566-d777-8888-99aabbccddee 53 +11223344-5566-d777-c888-99aabbccddee 54 +11223344-5566-d777-e888-99aabbccddee 55 +NULL 56 +11223344-5566-e777-8888-99aabbccddee 57 +11223344-5566-e777-c888-99aabbccddee 58 +11223344-5566-e777-e888-99aabbccddee 59 +NULL 60 +11223344-5566-f777-8888-99aabbccddee 61 +11223344-5566-f777-c888-99aabbccddee 62 +11223344-5566-f777-e888-99aabbccddee 63 +select * from t1 order by a; +a b +NULL 40 +NULL 32 +NULL 36 +NULL 44 +NULL 48 +NULL 52 +NULL 56 +NULL 60 +11223344-5566-0777-0888-99aabbccddee 0 +11223344-5566-1777-0888-99aabbccddee 4 +11223344-5566-2777-0888-99aabbccddee 8 +11223344-5566-3777-0888-99aabbccddee 12 +11223344-5566-4777-0888-99aabbccddee 16 +11223344-5566-5777-0888-99aabbccddee 20 +11223344-5566-6777-0888-99aabbccddee 24 +11223344-5566-6777-8888-99aabbccddee 25 +11223344-5566-6777-c888-99aabbccddee 26 +11223344-5566-6777-e888-99aabbccddee 27 +11223344-5566-7777-0888-99aabbccddee 28 +11223344-5566-7777-8888-99aabbccddee 29 +11223344-5566-7777-c888-99aabbccddee 30 +11223344-5566-7777-e888-99aabbccddee 31 +11223344-5566-8777-8888-99aabbccddee 33 +11223344-5566-8777-c888-99aabbccddee 34 +11223344-5566-8777-e888-99aabbccddee 35 +11223344-5566-9777-8888-99aabbccddee 37 +11223344-5566-9777-c888-99aabbccddee 38 +11223344-5566-9777-e888-99aabbccddee 39 +11223344-5566-a777-8888-99aabbccddee 41 +11223344-5566-a777-c888-99aabbccddee 42 +11223344-5566-a777-e888-99aabbccddee 43 +11223344-5566-b777-8888-99aabbccddee 45 +11223344-5566-b777-c888-99aabbccddee 46 +11223344-5566-b777-e888-99aabbccddee 47 +11223344-5566-c777-8888-99aabbccddee 49 +11223344-5566-c777-c888-99aabbccddee 50 +11223344-5566-c777-e888-99aabbccddee 51 +11223344-5566-d777-8888-99aabbccddee 53 +11223344-5566-d777-c888-99aabbccddee 54 +11223344-5566-d777-e888-99aabbccddee 55 +11223344-5566-e777-8888-99aabbccddee 57 +11223344-5566-e777-c888-99aabbccddee 58 +11223344-5566-e777-e888-99aabbccddee 59 +11223344-5566-f777-8888-99aabbccddee 61 +11223344-5566-f777-c888-99aabbccddee 62 +11223344-5566-f777-e888-99aabbccddee 63 +11223344-5566-0777-8888-99aabbccddee 1 +11223344-5566-1777-8888-99aabbccddee 5 +11223344-5566-2777-8888-99aabbccddee 9 +11223344-5566-3777-8888-99aabbccddee 13 +11223344-5566-4777-8888-99aabbccddee 17 +11223344-5566-5777-8888-99aabbccddee 21 +11223344-5566-0777-c888-99aabbccddee 2 +11223344-5566-1777-c888-99aabbccddee 6 +11223344-5566-2777-c888-99aabbccddee 10 +11223344-5566-3777-c888-99aabbccddee 14 +11223344-5566-4777-c888-99aabbccddee 18 +11223344-5566-5777-c888-99aabbccddee 22 +11223344-5566-0777-e888-99aabbccddee 3 +11223344-5566-1777-e888-99aabbccddee 7 +11223344-5566-2777-e888-99aabbccddee 11 +11223344-5566-3777-e888-99aabbccddee 15 +11223344-5566-4777-e888-99aabbccddee 19 +11223344-5566-5777-e888-99aabbccddee 23 +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` uuid DEFAULT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +# now let's use the table as above, but created in 10.11.4 +select * from t2; +a b +11223344-5566-0777-0888-99aabbccddee 0 +11223344-5566-0777-8888-99aabbccddee 1 +11223344-5566-0777-c888-99aabbccddee 2 +11223344-5566-0777-e888-99aabbccddee 3 +11223344-5566-1777-0888-99aabbccddee 4 +11223344-5566-1777-8888-99aabbccddee 5 +11223344-5566-1777-c888-99aabbccddee 6 +11223344-5566-1777-e888-99aabbccddee 7 +11223344-5566-2777-0888-99aabbccddee 8 +11223344-5566-2777-8888-99aabbccddee 9 +11223344-5566-2777-c888-99aabbccddee 10 +11223344-5566-2777-e888-99aabbccddee 11 +11223344-5566-3777-0888-99aabbccddee 12 +11223344-5566-3777-8888-99aabbccddee 13 +11223344-5566-3777-c888-99aabbccddee 14 +11223344-5566-3777-e888-99aabbccddee 15 +11223344-5566-4777-0888-99aabbccddee 16 +11223344-5566-4777-8888-99aabbccddee 17 +11223344-5566-4777-c888-99aabbccddee 18 +11223344-5566-4777-e888-99aabbccddee 19 +11223344-5566-5777-0888-99aabbccddee 20 +11223344-5566-5777-8888-99aabbccddee 21 +11223344-5566-5777-c888-99aabbccddee 22 +11223344-5566-5777-e888-99aabbccddee 23 +11223344-5566-6777-0888-99aabbccddee 24 +11223344-5566-6777-8888-99aabbccddee 25 +11223344-5566-6777-c888-99aabbccddee 26 +11223344-5566-6777-e888-99aabbccddee 27 +11223344-5566-7777-0888-99aabbccddee 28 +11223344-5566-7777-8888-99aabbccddee 29 +11223344-5566-7777-c888-99aabbccddee 30 +11223344-5566-7777-e888-99aabbccddee 31 +11223344-5566-8777-0888-99aabbccddee 32 +11223344-5566-8777-8888-99aabbccddee 33 +11223344-5566-8777-c888-99aabbccddee 34 +11223344-5566-8777-e888-99aabbccddee 35 +11223344-5566-9777-0888-99aabbccddee 36 +11223344-5566-9777-8888-99aabbccddee 37 +11223344-5566-9777-c888-99aabbccddee 38 +11223344-5566-9777-e888-99aabbccddee 39 +11223344-5566-a777-0888-99aabbccddee 40 +11223344-5566-a777-8888-99aabbccddee 41 +11223344-5566-a777-c888-99aabbccddee 42 +11223344-5566-a777-e888-99aabbccddee 43 +11223344-5566-b777-0888-99aabbccddee 44 +11223344-5566-b777-8888-99aabbccddee 45 +11223344-5566-b777-c888-99aabbccddee 46 +11223344-5566-b777-e888-99aabbccddee 47 +11223344-5566-c777-0888-99aabbccddee 48 +11223344-5566-c777-8888-99aabbccddee 49 +11223344-5566-c777-c888-99aabbccddee 50 +11223344-5566-c777-e888-99aabbccddee 51 +11223344-5566-d777-0888-99aabbccddee 52 +11223344-5566-d777-8888-99aabbccddee 53 +11223344-5566-d777-c888-99aabbccddee 54 +11223344-5566-d777-e888-99aabbccddee 55 +11223344-5566-e777-0888-99aabbccddee 56 +11223344-5566-e777-8888-99aabbccddee 57 +11223344-5566-e777-c888-99aabbccddee 58 +11223344-5566-e777-e888-99aabbccddee 59 +11223344-5566-f777-0888-99aabbccddee 60 +11223344-5566-f777-8888-99aabbccddee 61 +11223344-5566-f777-c888-99aabbccddee 62 +11223344-5566-f777-e888-99aabbccddee 63 +select * from t2 order by a; +a b +11223344-5566-0777-0888-99aabbccddee 0 +11223344-5566-1777-0888-99aabbccddee 4 +11223344-5566-2777-0888-99aabbccddee 8 +11223344-5566-3777-0888-99aabbccddee 12 +11223344-5566-4777-0888-99aabbccddee 16 +11223344-5566-5777-0888-99aabbccddee 20 +11223344-5566-6777-0888-99aabbccddee 24 +11223344-5566-7777-0888-99aabbccddee 28 +11223344-5566-8777-0888-99aabbccddee 32 +11223344-5566-9777-0888-99aabbccddee 36 +11223344-5566-a777-0888-99aabbccddee 40 +11223344-5566-b777-0888-99aabbccddee 44 +11223344-5566-c777-0888-99aabbccddee 48 +11223344-5566-d777-0888-99aabbccddee 52 +11223344-5566-e777-0888-99aabbccddee 56 +11223344-5566-f777-0888-99aabbccddee 60 +11223344-5566-0777-8888-99aabbccddee 1 +11223344-5566-1777-8888-99aabbccddee 5 +11223344-5566-2777-8888-99aabbccddee 9 +11223344-5566-3777-8888-99aabbccddee 13 +11223344-5566-4777-8888-99aabbccddee 17 +11223344-5566-5777-8888-99aabbccddee 21 +11223344-5566-6777-8888-99aabbccddee 25 +11223344-5566-7777-8888-99aabbccddee 29 +11223344-5566-8777-8888-99aabbccddee 33 +11223344-5566-9777-8888-99aabbccddee 37 +11223344-5566-a777-8888-99aabbccddee 41 +11223344-5566-b777-8888-99aabbccddee 45 +11223344-5566-c777-8888-99aabbccddee 49 +11223344-5566-d777-8888-99aabbccddee 53 +11223344-5566-e777-8888-99aabbccddee 57 +11223344-5566-f777-8888-99aabbccddee 61 +11223344-5566-0777-c888-99aabbccddee 2 +11223344-5566-1777-c888-99aabbccddee 6 +11223344-5566-2777-c888-99aabbccddee 10 +11223344-5566-3777-c888-99aabbccddee 14 +11223344-5566-4777-c888-99aabbccddee 18 +11223344-5566-5777-c888-99aabbccddee 22 +11223344-5566-6777-c888-99aabbccddee 26 +11223344-5566-7777-c888-99aabbccddee 30 +11223344-5566-8777-c888-99aabbccddee 34 +11223344-5566-9777-c888-99aabbccddee 38 +11223344-5566-a777-c888-99aabbccddee 42 +11223344-5566-b777-c888-99aabbccddee 46 +11223344-5566-c777-c888-99aabbccddee 50 +11223344-5566-d777-c888-99aabbccddee 54 +11223344-5566-e777-c888-99aabbccddee 58 +11223344-5566-f777-c888-99aabbccddee 62 +11223344-5566-0777-e888-99aabbccddee 3 +11223344-5566-1777-e888-99aabbccddee 7 +11223344-5566-2777-e888-99aabbccddee 11 +11223344-5566-3777-e888-99aabbccddee 15 +11223344-5566-4777-e888-99aabbccddee 19 +11223344-5566-5777-e888-99aabbccddee 23 +11223344-5566-6777-e888-99aabbccddee 27 +11223344-5566-7777-e888-99aabbccddee 31 +11223344-5566-8777-e888-99aabbccddee 35 +11223344-5566-9777-e888-99aabbccddee 39 +11223344-5566-a777-e888-99aabbccddee 43 +11223344-5566-b777-e888-99aabbccddee 47 +11223344-5566-c777-e888-99aabbccddee 51 +11223344-5566-d777-e888-99aabbccddee 55 +11223344-5566-e777-e888-99aabbccddee 59 +11223344-5566-f777-e888-99aabbccddee 63 +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` uuid DEFAULT NULL, + `b` int(11) NOT NULL, + KEY `a` (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +explain select * from t1 left join t2 on (t1.a=t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 64 +1 SIMPLE t2 ref a a 17 test.t1.a 1 Using where +select * from t1 left join t2 on (t1.a=t2.a); +a b a b +11223344-5566-0777-0888-99aabbccddee 0 11223344-5566-0777-0888-99aabbccddee 0 +11223344-5566-0777-8888-99aabbccddee 1 11223344-5566-0777-8888-99aabbccddee 1 +11223344-5566-0777-c888-99aabbccddee 2 11223344-5566-0777-c888-99aabbccddee 2 +11223344-5566-0777-e888-99aabbccddee 3 11223344-5566-0777-e888-99aabbccddee 3 +11223344-5566-1777-0888-99aabbccddee 4 11223344-5566-1777-0888-99aabbccddee 4 +11223344-5566-1777-8888-99aabbccddee 5 11223344-5566-1777-8888-99aabbccddee 5 +11223344-5566-1777-c888-99aabbccddee 6 11223344-5566-1777-c888-99aabbccddee 6 +11223344-5566-1777-e888-99aabbccddee 7 11223344-5566-1777-e888-99aabbccddee 7 +11223344-5566-2777-0888-99aabbccddee 8 11223344-5566-2777-0888-99aabbccddee 8 +11223344-5566-2777-8888-99aabbccddee 9 11223344-5566-2777-8888-99aabbccddee 9 +11223344-5566-2777-c888-99aabbccddee 10 11223344-5566-2777-c888-99aabbccddee 10 +11223344-5566-2777-e888-99aabbccddee 11 11223344-5566-2777-e888-99aabbccddee 11 +11223344-5566-3777-0888-99aabbccddee 12 11223344-5566-3777-0888-99aabbccddee 12 +11223344-5566-3777-8888-99aabbccddee 13 11223344-5566-3777-8888-99aabbccddee 13 +11223344-5566-3777-c888-99aabbccddee 14 11223344-5566-3777-c888-99aabbccddee 14 +11223344-5566-3777-e888-99aabbccddee 15 11223344-5566-3777-e888-99aabbccddee 15 +11223344-5566-4777-0888-99aabbccddee 16 11223344-5566-4777-0888-99aabbccddee 16 +11223344-5566-4777-8888-99aabbccddee 17 11223344-5566-4777-8888-99aabbccddee 17 +11223344-5566-4777-c888-99aabbccddee 18 11223344-5566-4777-c888-99aabbccddee 18 +11223344-5566-4777-e888-99aabbccddee 19 11223344-5566-4777-e888-99aabbccddee 19 +11223344-5566-5777-0888-99aabbccddee 20 11223344-5566-5777-0888-99aabbccddee 20 +11223344-5566-5777-8888-99aabbccddee 21 11223344-5566-5777-8888-99aabbccddee 21 +11223344-5566-5777-c888-99aabbccddee 22 11223344-5566-5777-c888-99aabbccddee 22 +11223344-5566-5777-e888-99aabbccddee 23 11223344-5566-5777-e888-99aabbccddee 23 +11223344-5566-6777-0888-99aabbccddee 24 11223344-5566-6777-0888-99aabbccddee 24 +11223344-5566-6777-8888-99aabbccddee 25 11223344-5566-6777-8888-99aabbccddee 25 +11223344-5566-6777-c888-99aabbccddee 26 11223344-5566-6777-c888-99aabbccddee 26 +11223344-5566-6777-e888-99aabbccddee 27 11223344-5566-6777-e888-99aabbccddee 27 +11223344-5566-7777-0888-99aabbccddee 28 11223344-5566-7777-0888-99aabbccddee 28 +11223344-5566-7777-8888-99aabbccddee 29 11223344-5566-7777-8888-99aabbccddee 29 +11223344-5566-7777-c888-99aabbccddee 30 11223344-5566-7777-c888-99aabbccddee 30 +11223344-5566-7777-e888-99aabbccddee 31 11223344-5566-7777-e888-99aabbccddee 31 +11223344-5566-8777-8888-99aabbccddee 33 11223344-5566-8777-8888-99aabbccddee 33 +11223344-5566-8777-c888-99aabbccddee 34 11223344-5566-8777-c888-99aabbccddee 34 +11223344-5566-8777-e888-99aabbccddee 35 11223344-5566-8777-e888-99aabbccddee 35 +11223344-5566-9777-8888-99aabbccddee 37 11223344-5566-9777-8888-99aabbccddee 37 +11223344-5566-9777-c888-99aabbccddee 38 11223344-5566-9777-c888-99aabbccddee 38 +11223344-5566-9777-e888-99aabbccddee 39 11223344-5566-9777-e888-99aabbccddee 39 +11223344-5566-a777-8888-99aabbccddee 41 11223344-5566-a777-8888-99aabbccddee 41 +11223344-5566-a777-c888-99aabbccddee 42 11223344-5566-a777-c888-99aabbccddee 42 +11223344-5566-a777-e888-99aabbccddee 43 11223344-5566-a777-e888-99aabbccddee 43 +11223344-5566-b777-8888-99aabbccddee 45 11223344-5566-b777-8888-99aabbccddee 45 +11223344-5566-b777-c888-99aabbccddee 46 11223344-5566-b777-c888-99aabbccddee 46 +11223344-5566-b777-e888-99aabbccddee 47 11223344-5566-b777-e888-99aabbccddee 47 +11223344-5566-c777-8888-99aabbccddee 49 11223344-5566-c777-8888-99aabbccddee 49 +11223344-5566-c777-c888-99aabbccddee 50 11223344-5566-c777-c888-99aabbccddee 50 +11223344-5566-c777-e888-99aabbccddee 51 11223344-5566-c777-e888-99aabbccddee 51 +11223344-5566-d777-8888-99aabbccddee 53 11223344-5566-d777-8888-99aabbccddee 53 +11223344-5566-d777-c888-99aabbccddee 54 11223344-5566-d777-c888-99aabbccddee 54 +11223344-5566-d777-e888-99aabbccddee 55 11223344-5566-d777-e888-99aabbccddee 55 +11223344-5566-e777-8888-99aabbccddee 57 11223344-5566-e777-8888-99aabbccddee 57 +11223344-5566-e777-c888-99aabbccddee 58 11223344-5566-e777-c888-99aabbccddee 58 +11223344-5566-e777-e888-99aabbccddee 59 11223344-5566-e777-e888-99aabbccddee 59 +11223344-5566-f777-8888-99aabbccddee 61 11223344-5566-f777-8888-99aabbccddee 61 +11223344-5566-f777-c888-99aabbccddee 62 11223344-5566-f777-c888-99aabbccddee 62 +11223344-5566-f777-e888-99aabbccddee 63 11223344-5566-f777-e888-99aabbccddee 63 +NULL 32 NULL NULL +NULL 36 NULL NULL +NULL 40 NULL NULL +NULL 44 NULL NULL +NULL 48 NULL NULL +NULL 52 NULL NULL +NULL 56 NULL NULL +NULL 60 NULL NULL +explain select * from t1 left join t2 on (t1.a<=>t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 64 +1 SIMPLE t2 ref a a 17 test.t1.a 1 Using where +select * from t1 left join t2 on (t1.a<=>t2.a); +a b a b +11223344-5566-0777-0888-99aabbccddee 0 11223344-5566-0777-0888-99aabbccddee 0 +11223344-5566-0777-8888-99aabbccddee 1 11223344-5566-0777-8888-99aabbccddee 1 +11223344-5566-0777-c888-99aabbccddee 2 11223344-5566-0777-c888-99aabbccddee 2 +11223344-5566-0777-e888-99aabbccddee 3 11223344-5566-0777-e888-99aabbccddee 3 +11223344-5566-1777-0888-99aabbccddee 4 11223344-5566-1777-0888-99aabbccddee 4 +11223344-5566-1777-8888-99aabbccddee 5 11223344-5566-1777-8888-99aabbccddee 5 +11223344-5566-1777-c888-99aabbccddee 6 11223344-5566-1777-c888-99aabbccddee 6 +11223344-5566-1777-e888-99aabbccddee 7 11223344-5566-1777-e888-99aabbccddee 7 +11223344-5566-2777-0888-99aabbccddee 8 11223344-5566-2777-0888-99aabbccddee 8 +11223344-5566-2777-8888-99aabbccddee 9 11223344-5566-2777-8888-99aabbccddee 9 +11223344-5566-2777-c888-99aabbccddee 10 11223344-5566-2777-c888-99aabbccddee 10 +11223344-5566-2777-e888-99aabbccddee 11 11223344-5566-2777-e888-99aabbccddee 11 +11223344-5566-3777-0888-99aabbccddee 12 11223344-5566-3777-0888-99aabbccddee 12 +11223344-5566-3777-8888-99aabbccddee 13 11223344-5566-3777-8888-99aabbccddee 13 +11223344-5566-3777-c888-99aabbccddee 14 11223344-5566-3777-c888-99aabbccddee 14 +11223344-5566-3777-e888-99aabbccddee 15 11223344-5566-3777-e888-99aabbccddee 15 +11223344-5566-4777-0888-99aabbccddee 16 11223344-5566-4777-0888-99aabbccddee 16 +11223344-5566-4777-8888-99aabbccddee 17 11223344-5566-4777-8888-99aabbccddee 17 +11223344-5566-4777-c888-99aabbccddee 18 11223344-5566-4777-c888-99aabbccddee 18 +11223344-5566-4777-e888-99aabbccddee 19 11223344-5566-4777-e888-99aabbccddee 19 +11223344-5566-5777-0888-99aabbccddee 20 11223344-5566-5777-0888-99aabbccddee 20 +11223344-5566-5777-8888-99aabbccddee 21 11223344-5566-5777-8888-99aabbccddee 21 +11223344-5566-5777-c888-99aabbccddee 22 11223344-5566-5777-c888-99aabbccddee 22 +11223344-5566-5777-e888-99aabbccddee 23 11223344-5566-5777-e888-99aabbccddee 23 +11223344-5566-6777-0888-99aabbccddee 24 11223344-5566-6777-0888-99aabbccddee 24 +11223344-5566-6777-8888-99aabbccddee 25 11223344-5566-6777-8888-99aabbccddee 25 +11223344-5566-6777-c888-99aabbccddee 26 11223344-5566-6777-c888-99aabbccddee 26 +11223344-5566-6777-e888-99aabbccddee 27 11223344-5566-6777-e888-99aabbccddee 27 +11223344-5566-7777-0888-99aabbccddee 28 11223344-5566-7777-0888-99aabbccddee 28 +11223344-5566-7777-8888-99aabbccddee 29 11223344-5566-7777-8888-99aabbccddee 29 +11223344-5566-7777-c888-99aabbccddee 30 11223344-5566-7777-c888-99aabbccddee 30 +11223344-5566-7777-e888-99aabbccddee 31 11223344-5566-7777-e888-99aabbccddee 31 +11223344-5566-8777-8888-99aabbccddee 33 11223344-5566-8777-8888-99aabbccddee 33 +11223344-5566-8777-c888-99aabbccddee 34 11223344-5566-8777-c888-99aabbccddee 34 +11223344-5566-8777-e888-99aabbccddee 35 11223344-5566-8777-e888-99aabbccddee 35 +11223344-5566-9777-8888-99aabbccddee 37 11223344-5566-9777-8888-99aabbccddee 37 +11223344-5566-9777-c888-99aabbccddee 38 11223344-5566-9777-c888-99aabbccddee 38 +11223344-5566-9777-e888-99aabbccddee 39 11223344-5566-9777-e888-99aabbccddee 39 +11223344-5566-a777-8888-99aabbccddee 41 11223344-5566-a777-8888-99aabbccddee 41 +11223344-5566-a777-c888-99aabbccddee 42 11223344-5566-a777-c888-99aabbccddee 42 +11223344-5566-a777-e888-99aabbccddee 43 11223344-5566-a777-e888-99aabbccddee 43 +11223344-5566-b777-8888-99aabbccddee 45 11223344-5566-b777-8888-99aabbccddee 45 +11223344-5566-b777-c888-99aabbccddee 46 11223344-5566-b777-c888-99aabbccddee 46 +11223344-5566-b777-e888-99aabbccddee 47 11223344-5566-b777-e888-99aabbccddee 47 +11223344-5566-c777-8888-99aabbccddee 49 11223344-5566-c777-8888-99aabbccddee 49 +11223344-5566-c777-c888-99aabbccddee 50 11223344-5566-c777-c888-99aabbccddee 50 +11223344-5566-c777-e888-99aabbccddee 51 11223344-5566-c777-e888-99aabbccddee 51 +11223344-5566-d777-8888-99aabbccddee 53 11223344-5566-d777-8888-99aabbccddee 53 +11223344-5566-d777-c888-99aabbccddee 54 11223344-5566-d777-c888-99aabbccddee 54 +11223344-5566-d777-e888-99aabbccddee 55 11223344-5566-d777-e888-99aabbccddee 55 +11223344-5566-e777-8888-99aabbccddee 57 11223344-5566-e777-8888-99aabbccddee 57 +11223344-5566-e777-c888-99aabbccddee 58 11223344-5566-e777-c888-99aabbccddee 58 +11223344-5566-e777-e888-99aabbccddee 59 11223344-5566-e777-e888-99aabbccddee 59 +11223344-5566-f777-8888-99aabbccddee 61 11223344-5566-f777-8888-99aabbccddee 61 +11223344-5566-f777-c888-99aabbccddee 62 11223344-5566-f777-c888-99aabbccddee 62 +11223344-5566-f777-e888-99aabbccddee 63 11223344-5566-f777-e888-99aabbccddee 63 +NULL 32 NULL NULL +NULL 36 NULL NULL +NULL 40 NULL NULL +NULL 44 NULL NULL +NULL 48 NULL NULL +NULL 52 NULL NULL +NULL 56 NULL NULL +NULL 60 NULL NULL +explain select * from t2 left join t1 on (t1.a=t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 64 +1 SIMPLE t1 ref a a 17 test.t2.a 1 Using where +select * from t2 left join t1 on (t1.a=t2.a); +a b a b +11223344-5566-0777-0888-99aabbccddee 0 11223344-5566-0777-0888-99aabbccddee 0 +11223344-5566-0777-8888-99aabbccddee 1 11223344-5566-0777-8888-99aabbccddee 1 +11223344-5566-0777-c888-99aabbccddee 2 11223344-5566-0777-c888-99aabbccddee 2 +11223344-5566-0777-e888-99aabbccddee 3 11223344-5566-0777-e888-99aabbccddee 3 +11223344-5566-1777-0888-99aabbccddee 4 11223344-5566-1777-0888-99aabbccddee 4 +11223344-5566-1777-8888-99aabbccddee 5 11223344-5566-1777-8888-99aabbccddee 5 +11223344-5566-1777-c888-99aabbccddee 6 11223344-5566-1777-c888-99aabbccddee 6 +11223344-5566-1777-e888-99aabbccddee 7 11223344-5566-1777-e888-99aabbccddee 7 +11223344-5566-2777-0888-99aabbccddee 8 11223344-5566-2777-0888-99aabbccddee 8 +11223344-5566-2777-8888-99aabbccddee 9 11223344-5566-2777-8888-99aabbccddee 9 +11223344-5566-2777-c888-99aabbccddee 10 11223344-5566-2777-c888-99aabbccddee 10 +11223344-5566-2777-e888-99aabbccddee 11 11223344-5566-2777-e888-99aabbccddee 11 +11223344-5566-3777-0888-99aabbccddee 12 11223344-5566-3777-0888-99aabbccddee 12 +11223344-5566-3777-8888-99aabbccddee 13 11223344-5566-3777-8888-99aabbccddee 13 +11223344-5566-3777-c888-99aabbccddee 14 11223344-5566-3777-c888-99aabbccddee 14 +11223344-5566-3777-e888-99aabbccddee 15 11223344-5566-3777-e888-99aabbccddee 15 +11223344-5566-4777-0888-99aabbccddee 16 11223344-5566-4777-0888-99aabbccddee 16 +11223344-5566-4777-8888-99aabbccddee 17 11223344-5566-4777-8888-99aabbccddee 17 +11223344-5566-4777-c888-99aabbccddee 18 11223344-5566-4777-c888-99aabbccddee 18 +11223344-5566-4777-e888-99aabbccddee 19 11223344-5566-4777-e888-99aabbccddee 19 +11223344-5566-5777-0888-99aabbccddee 20 11223344-5566-5777-0888-99aabbccddee 20 +11223344-5566-5777-8888-99aabbccddee 21 11223344-5566-5777-8888-99aabbccddee 21 +11223344-5566-5777-c888-99aabbccddee 22 11223344-5566-5777-c888-99aabbccddee 22 +11223344-5566-5777-e888-99aabbccddee 23 11223344-5566-5777-e888-99aabbccddee 23 +11223344-5566-6777-0888-99aabbccddee 24 11223344-5566-6777-0888-99aabbccddee 24 +11223344-5566-6777-8888-99aabbccddee 25 11223344-5566-6777-8888-99aabbccddee 25 +11223344-5566-6777-c888-99aabbccddee 26 11223344-5566-6777-c888-99aabbccddee 26 +11223344-5566-6777-e888-99aabbccddee 27 11223344-5566-6777-e888-99aabbccddee 27 +11223344-5566-7777-0888-99aabbccddee 28 11223344-5566-7777-0888-99aabbccddee 28 +11223344-5566-7777-8888-99aabbccddee 29 11223344-5566-7777-8888-99aabbccddee 29 +11223344-5566-7777-c888-99aabbccddee 30 11223344-5566-7777-c888-99aabbccddee 30 +11223344-5566-7777-e888-99aabbccddee 31 11223344-5566-7777-e888-99aabbccddee 31 +11223344-5566-8777-0888-99aabbccddee 32 NULL NULL +11223344-5566-8777-8888-99aabbccddee 33 11223344-5566-8777-8888-99aabbccddee 33 +11223344-5566-8777-c888-99aabbccddee 34 11223344-5566-8777-c888-99aabbccddee 34 +11223344-5566-8777-e888-99aabbccddee 35 11223344-5566-8777-e888-99aabbccddee 35 +11223344-5566-9777-0888-99aabbccddee 36 NULL NULL +11223344-5566-9777-8888-99aabbccddee 37 11223344-5566-9777-8888-99aabbccddee 37 +11223344-5566-9777-c888-99aabbccddee 38 11223344-5566-9777-c888-99aabbccddee 38 +11223344-5566-9777-e888-99aabbccddee 39 11223344-5566-9777-e888-99aabbccddee 39 +11223344-5566-a777-0888-99aabbccddee 40 NULL NULL +11223344-5566-a777-8888-99aabbccddee 41 11223344-5566-a777-8888-99aabbccddee 41 +11223344-5566-a777-c888-99aabbccddee 42 11223344-5566-a777-c888-99aabbccddee 42 +11223344-5566-a777-e888-99aabbccddee 43 11223344-5566-a777-e888-99aabbccddee 43 +11223344-5566-b777-0888-99aabbccddee 44 NULL NULL +11223344-5566-b777-8888-99aabbccddee 45 11223344-5566-b777-8888-99aabbccddee 45 +11223344-5566-b777-c888-99aabbccddee 46 11223344-5566-b777-c888-99aabbccddee 46 +11223344-5566-b777-e888-99aabbccddee 47 11223344-5566-b777-e888-99aabbccddee 47 +11223344-5566-c777-0888-99aabbccddee 48 NULL NULL +11223344-5566-c777-8888-99aabbccddee 49 11223344-5566-c777-8888-99aabbccddee 49 +11223344-5566-c777-c888-99aabbccddee 50 11223344-5566-c777-c888-99aabbccddee 50 +11223344-5566-c777-e888-99aabbccddee 51 11223344-5566-c777-e888-99aabbccddee 51 +11223344-5566-d777-0888-99aabbccddee 52 NULL NULL +11223344-5566-d777-8888-99aabbccddee 53 11223344-5566-d777-8888-99aabbccddee 53 +11223344-5566-d777-c888-99aabbccddee 54 11223344-5566-d777-c888-99aabbccddee 54 +11223344-5566-d777-e888-99aabbccddee 55 11223344-5566-d777-e888-99aabbccddee 55 +11223344-5566-e777-0888-99aabbccddee 56 NULL NULL +11223344-5566-e777-8888-99aabbccddee 57 11223344-5566-e777-8888-99aabbccddee 57 +11223344-5566-e777-c888-99aabbccddee 58 11223344-5566-e777-c888-99aabbccddee 58 +11223344-5566-e777-e888-99aabbccddee 59 11223344-5566-e777-e888-99aabbccddee 59 +11223344-5566-f777-0888-99aabbccddee 60 NULL NULL +11223344-5566-f777-8888-99aabbccddee 61 11223344-5566-f777-8888-99aabbccddee 61 +11223344-5566-f777-c888-99aabbccddee 62 11223344-5566-f777-c888-99aabbccddee 62 +11223344-5566-f777-e888-99aabbccddee 63 11223344-5566-f777-e888-99aabbccddee 63 +explain select * from t2 left join t1 on (t1.a<=>t2.a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 64 +1 SIMPLE t1 ref a a 17 test.t2.a 1 Using where +select * from t2 left join t1 on (t1.a<=>t2.a); +a b a b +11223344-5566-0777-0888-99aabbccddee 0 11223344-5566-0777-0888-99aabbccddee 0 +11223344-5566-0777-8888-99aabbccddee 1 11223344-5566-0777-8888-99aabbccddee 1 +11223344-5566-0777-c888-99aabbccddee 2 11223344-5566-0777-c888-99aabbccddee 2 +11223344-5566-0777-e888-99aabbccddee 3 11223344-5566-0777-e888-99aabbccddee 3 +11223344-5566-1777-0888-99aabbccddee 4 11223344-5566-1777-0888-99aabbccddee 4 +11223344-5566-1777-8888-99aabbccddee 5 11223344-5566-1777-8888-99aabbccddee 5 +11223344-5566-1777-c888-99aabbccddee 6 11223344-5566-1777-c888-99aabbccddee 6 +11223344-5566-1777-e888-99aabbccddee 7 11223344-5566-1777-e888-99aabbccddee 7 +11223344-5566-2777-0888-99aabbccddee 8 11223344-5566-2777-0888-99aabbccddee 8 +11223344-5566-2777-8888-99aabbccddee 9 11223344-5566-2777-8888-99aabbccddee 9 +11223344-5566-2777-c888-99aabbccddee 10 11223344-5566-2777-c888-99aabbccddee 10 +11223344-5566-2777-e888-99aabbccddee 11 11223344-5566-2777-e888-99aabbccddee 11 +11223344-5566-3777-0888-99aabbccddee 12 11223344-5566-3777-0888-99aabbccddee 12 +11223344-5566-3777-8888-99aabbccddee 13 11223344-5566-3777-8888-99aabbccddee 13 +11223344-5566-3777-c888-99aabbccddee 14 11223344-5566-3777-c888-99aabbccddee 14 +11223344-5566-3777-e888-99aabbccddee 15 11223344-5566-3777-e888-99aabbccddee 15 +11223344-5566-4777-0888-99aabbccddee 16 11223344-5566-4777-0888-99aabbccddee 16 +11223344-5566-4777-8888-99aabbccddee 17 11223344-5566-4777-8888-99aabbccddee 17 +11223344-5566-4777-c888-99aabbccddee 18 11223344-5566-4777-c888-99aabbccddee 18 +11223344-5566-4777-e888-99aabbccddee 19 11223344-5566-4777-e888-99aabbccddee 19 +11223344-5566-5777-0888-99aabbccddee 20 11223344-5566-5777-0888-99aabbccddee 20 +11223344-5566-5777-8888-99aabbccddee 21 11223344-5566-5777-8888-99aabbccddee 21 +11223344-5566-5777-c888-99aabbccddee 22 11223344-5566-5777-c888-99aabbccddee 22 +11223344-5566-5777-e888-99aabbccddee 23 11223344-5566-5777-e888-99aabbccddee 23 +11223344-5566-6777-0888-99aabbccddee 24 11223344-5566-6777-0888-99aabbccddee 24 +11223344-5566-6777-8888-99aabbccddee 25 11223344-5566-6777-8888-99aabbccddee 25 +11223344-5566-6777-c888-99aabbccddee 26 11223344-5566-6777-c888-99aabbccddee 26 +11223344-5566-6777-e888-99aabbccddee 27 11223344-5566-6777-e888-99aabbccddee 27 +11223344-5566-7777-0888-99aabbccddee 28 11223344-5566-7777-0888-99aabbccddee 28 +11223344-5566-7777-8888-99aabbccddee 29 11223344-5566-7777-8888-99aabbccddee 29 +11223344-5566-7777-c888-99aabbccddee 30 11223344-5566-7777-c888-99aabbccddee 30 +11223344-5566-7777-e888-99aabbccddee 31 11223344-5566-7777-e888-99aabbccddee 31 +11223344-5566-8777-0888-99aabbccddee 32 NULL 32 +11223344-5566-8777-0888-99aabbccddee 32 NULL 36 +11223344-5566-8777-0888-99aabbccddee 32 NULL 40 +11223344-5566-8777-0888-99aabbccddee 32 NULL 44 +11223344-5566-8777-0888-99aabbccddee 32 NULL 48 +11223344-5566-8777-0888-99aabbccddee 32 NULL 52 +11223344-5566-8777-0888-99aabbccddee 32 NULL 56 +11223344-5566-8777-0888-99aabbccddee 32 NULL 60 +11223344-5566-8777-8888-99aabbccddee 33 11223344-5566-8777-8888-99aabbccddee 33 +11223344-5566-8777-c888-99aabbccddee 34 11223344-5566-8777-c888-99aabbccddee 34 +11223344-5566-8777-e888-99aabbccddee 35 11223344-5566-8777-e888-99aabbccddee 35 +11223344-5566-9777-0888-99aabbccddee 36 NULL 32 +11223344-5566-9777-0888-99aabbccddee 36 NULL 36 +11223344-5566-9777-0888-99aabbccddee 36 NULL 40 +11223344-5566-9777-0888-99aabbccddee 36 NULL 44 +11223344-5566-9777-0888-99aabbccddee 36 NULL 48 +11223344-5566-9777-0888-99aabbccddee 36 NULL 52 +11223344-5566-9777-0888-99aabbccddee 36 NULL 56 +11223344-5566-9777-0888-99aabbccddee 36 NULL 60 +11223344-5566-9777-8888-99aabbccddee 37 11223344-5566-9777-8888-99aabbccddee 37 +11223344-5566-9777-c888-99aabbccddee 38 11223344-5566-9777-c888-99aabbccddee 38 +11223344-5566-9777-e888-99aabbccddee 39 11223344-5566-9777-e888-99aabbccddee 39 +11223344-5566-a777-0888-99aabbccddee 40 NULL 32 +11223344-5566-a777-0888-99aabbccddee 40 NULL 36 +11223344-5566-a777-0888-99aabbccddee 40 NULL 40 +11223344-5566-a777-0888-99aabbccddee 40 NULL 44 +11223344-5566-a777-0888-99aabbccddee 40 NULL 48 +11223344-5566-a777-0888-99aabbccddee 40 NULL 52 +11223344-5566-a777-0888-99aabbccddee 40 NULL 56 +11223344-5566-a777-0888-99aabbccddee 40 NULL 60 +11223344-5566-a777-8888-99aabbccddee 41 11223344-5566-a777-8888-99aabbccddee 41 +11223344-5566-a777-c888-99aabbccddee 42 11223344-5566-a777-c888-99aabbccddee 42 +11223344-5566-a777-e888-99aabbccddee 43 11223344-5566-a777-e888-99aabbccddee 43 +11223344-5566-b777-0888-99aabbccddee 44 NULL 32 +11223344-5566-b777-0888-99aabbccddee 44 NULL 36 +11223344-5566-b777-0888-99aabbccddee 44 NULL 40 +11223344-5566-b777-0888-99aabbccddee 44 NULL 44 +11223344-5566-b777-0888-99aabbccddee 44 NULL 48 +11223344-5566-b777-0888-99aabbccddee 44 NULL 52 +11223344-5566-b777-0888-99aabbccddee 44 NULL 56 +11223344-5566-b777-0888-99aabbccddee 44 NULL 60 +11223344-5566-b777-8888-99aabbccddee 45 11223344-5566-b777-8888-99aabbccddee 45 +11223344-5566-b777-c888-99aabbccddee 46 11223344-5566-b777-c888-99aabbccddee 46 +11223344-5566-b777-e888-99aabbccddee 47 11223344-5566-b777-e888-99aabbccddee 47 +11223344-5566-c777-0888-99aabbccddee 48 NULL 32 +11223344-5566-c777-0888-99aabbccddee 48 NULL 36 +11223344-5566-c777-0888-99aabbccddee 48 NULL 40 +11223344-5566-c777-0888-99aabbccddee 48 NULL 44 +11223344-5566-c777-0888-99aabbccddee 48 NULL 48 +11223344-5566-c777-0888-99aabbccddee 48 NULL 52 +11223344-5566-c777-0888-99aabbccddee 48 NULL 56 +11223344-5566-c777-0888-99aabbccddee 48 NULL 60 +11223344-5566-c777-8888-99aabbccddee 49 11223344-5566-c777-8888-99aabbccddee 49 +11223344-5566-c777-c888-99aabbccddee 50 11223344-5566-c777-c888-99aabbccddee 50 +11223344-5566-c777-e888-99aabbccddee 51 11223344-5566-c777-e888-99aabbccddee 51 +11223344-5566-d777-0888-99aabbccddee 52 NULL 32 +11223344-5566-d777-0888-99aabbccddee 52 NULL 36 +11223344-5566-d777-0888-99aabbccddee 52 NULL 40 +11223344-5566-d777-0888-99aabbccddee 52 NULL 44 +11223344-5566-d777-0888-99aabbccddee 52 NULL 48 +11223344-5566-d777-0888-99aabbccddee 52 NULL 52 +11223344-5566-d777-0888-99aabbccddee 52 NULL 56 +11223344-5566-d777-0888-99aabbccddee 52 NULL 60 +11223344-5566-d777-8888-99aabbccddee 53 11223344-5566-d777-8888-99aabbccddee 53 +11223344-5566-d777-c888-99aabbccddee 54 11223344-5566-d777-c888-99aabbccddee 54 +11223344-5566-d777-e888-99aabbccddee 55 11223344-5566-d777-e888-99aabbccddee 55 +11223344-5566-e777-0888-99aabbccddee 56 NULL 32 +11223344-5566-e777-0888-99aabbccddee 56 NULL 36 +11223344-5566-e777-0888-99aabbccddee 56 NULL 40 +11223344-5566-e777-0888-99aabbccddee 56 NULL 44 +11223344-5566-e777-0888-99aabbccddee 56 NULL 48 +11223344-5566-e777-0888-99aabbccddee 56 NULL 52 +11223344-5566-e777-0888-99aabbccddee 56 NULL 56 +11223344-5566-e777-0888-99aabbccddee 56 NULL 60 +11223344-5566-e777-8888-99aabbccddee 57 11223344-5566-e777-8888-99aabbccddee 57 +11223344-5566-e777-c888-99aabbccddee 58 11223344-5566-e777-c888-99aabbccddee 58 +11223344-5566-e777-e888-99aabbccddee 59 11223344-5566-e777-e888-99aabbccddee 59 +11223344-5566-f777-0888-99aabbccddee 60 NULL 32 +11223344-5566-f777-0888-99aabbccddee 60 NULL 36 +11223344-5566-f777-0888-99aabbccddee 60 NULL 40 +11223344-5566-f777-0888-99aabbccddee 60 NULL 44 +11223344-5566-f777-0888-99aabbccddee 60 NULL 48 +11223344-5566-f777-0888-99aabbccddee 60 NULL 52 +11223344-5566-f777-0888-99aabbccddee 60 NULL 56 +11223344-5566-f777-0888-99aabbccddee 60 NULL 60 +11223344-5566-f777-8888-99aabbccddee 61 11223344-5566-f777-8888-99aabbccddee 61 +11223344-5566-f777-c888-99aabbccddee 62 11223344-5566-f777-c888-99aabbccddee 62 +11223344-5566-f777-e888-99aabbccddee 63 11223344-5566-f777-e888-99aabbccddee 63 +Warning 1292 Incorrect uuid value: '11223344-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-8777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-9777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-a777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-b777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-c777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-d777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-e777-0888-99aabbccddee' +Warning 1292 Incorrect uuid value: '11223344-5566-f777-0888-99aabbccddee' +Warnings: +select * from t1 union select * from t2; +a b +11223344-5566-0777-0888-99aabbccddee 0 +11223344-5566-0777-8888-99aabbccddee 1 +11223344-5566-0777-c888-99aabbccddee 2 +11223344-5566-0777-e888-99aabbccddee 3 +11223344-5566-1777-0888-99aabbccddee 4 +11223344-5566-1777-8888-99aabbccddee 5 +11223344-5566-1777-c888-99aabbccddee 6 +11223344-5566-1777-e888-99aabbccddee 7 +11223344-5566-2777-0888-99aabbccddee 8 +11223344-5566-2777-8888-99aabbccddee 9 +11223344-5566-2777-c888-99aabbccddee 10 +11223344-5566-2777-e888-99aabbccddee 11 +11223344-5566-3777-0888-99aabbccddee 12 +11223344-5566-3777-8888-99aabbccddee 13 +11223344-5566-3777-c888-99aabbccddee 14 +11223344-5566-3777-e888-99aabbccddee 15 +11223344-5566-4777-0888-99aabbccddee 16 +11223344-5566-4777-8888-99aabbccddee 17 +11223344-5566-4777-c888-99aabbccddee 18 +11223344-5566-4777-e888-99aabbccddee 19 +11223344-5566-5777-0888-99aabbccddee 20 +11223344-5566-5777-8888-99aabbccddee 21 +11223344-5566-5777-c888-99aabbccddee 22 +11223344-5566-5777-e888-99aabbccddee 23 +11223344-5566-6777-0888-99aabbccddee 24 +11223344-5566-6777-8888-99aabbccddee 25 +11223344-5566-6777-c888-99aabbccddee 26 +11223344-5566-6777-e888-99aabbccddee 27 +11223344-5566-7777-0888-99aabbccddee 28 +11223344-5566-7777-8888-99aabbccddee 29 +11223344-5566-7777-c888-99aabbccddee 30 +11223344-5566-7777-e888-99aabbccddee 31 +11223344-5566-8777-8888-99aabbccddee 33 +11223344-5566-8777-c888-99aabbccddee 34 +11223344-5566-8777-e888-99aabbccddee 35 +11223344-5566-9777-8888-99aabbccddee 37 +11223344-5566-9777-c888-99aabbccddee 38 +11223344-5566-9777-e888-99aabbccddee 39 +11223344-5566-a777-8888-99aabbccddee 41 +11223344-5566-a777-c888-99aabbccddee 42 +11223344-5566-a777-e888-99aabbccddee 43 +11223344-5566-b777-8888-99aabbccddee 45 +11223344-5566-b777-c888-99aabbccddee 46 +11223344-5566-b777-e888-99aabbccddee 47 +11223344-5566-c777-8888-99aabbccddee 49 +11223344-5566-c777-c888-99aabbccddee 50 +11223344-5566-c777-e888-99aabbccddee 51 +11223344-5566-d777-8888-99aabbccddee 53 +11223344-5566-d777-c888-99aabbccddee 54 +11223344-5566-d777-e888-99aabbccddee 55 +11223344-5566-e777-8888-99aabbccddee 57 +11223344-5566-e777-c888-99aabbccddee 58 +11223344-5566-e777-e888-99aabbccddee 59 +11223344-5566-f777-8888-99aabbccddee 61 +11223344-5566-f777-c888-99aabbccddee 62 +11223344-5566-f777-e888-99aabbccddee 63 +NULL 32 +NULL 36 +NULL 40 +NULL 44 +NULL 48 +NULL 52 +NULL 56 +NULL 60 +alter ignore table t2 force; +Warnings: +Warning 1292 Incorrect uuid value: '11223344-5566-8777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 33 +Warning 1292 Incorrect uuid value: '11223344-5566-9777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 37 +Warning 1292 Incorrect uuid value: '11223344-5566-a777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 41 +Warning 1292 Incorrect uuid value: '11223344-5566-b777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 45 +Warning 1292 Incorrect uuid value: '11223344-5566-c777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 49 +Warning 1292 Incorrect uuid value: '11223344-5566-d777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 53 +Warning 1292 Incorrect uuid value: '11223344-5566-e777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 57 +Warning 1292 Incorrect uuid value: '11223344-5566-f777-0888-99aabbccddee' for column `test`.`t2`.`a` at row 61 +drop table t1, t2; diff --git a/plugin/type_uuid/mysql-test/type_uuid/order.test b/plugin/type_uuid/mysql-test/type_uuid/order.test new file mode 100644 index 00000000000..46f76da98e3 --- /dev/null +++ b/plugin/type_uuid/mysql-test/type_uuid/order.test @@ -0,0 +1,40 @@ +# try all combinations of version and variant +source include/have_sequence.inc; + +create table t1 (a uuid, b int not null, index (a)); +insert t1 select sformat('11223344-5566-{:x}777-{}888-99aabbccddee', seq div 4, elt(1+(seq % 4),0,8,'c','e')),seq from seq_0_to_63; +select * from t1; +select * from t1 order by a; +show create table t1; + +--echo # now let's use the table as above, but created in 10.11.4 +let $datadir= `select @@datadir`; +--copy_file $MTR_SUITE_DIR/std_data/mdev-29959.frm $datadir/test/t2.frm +--copy_file $MTR_SUITE_DIR/std_data/mdev-29959.MYI $datadir/test/t2.MYI +--copy_file $MTR_SUITE_DIR/std_data/mdev-29959.MYD $datadir/test/t2.MYD +select * from t2; +select * from t2 order by a; +show create table t2; + +explain select * from t1 left join t2 on (t1.a=t2.a); +--sorted_result +select * from t1 left join t2 on (t1.a=t2.a); + +explain select * from t1 left join t2 on (t1.a<=>t2.a); +--sorted_result +select * from t1 left join t2 on (t1.a<=>t2.a); + +explain select * from t2 left join t1 on (t1.a=t2.a); +--sorted_result +select * from t2 left join t1 on (t1.a=t2.a); + +explain select * from t2 left join t1 on (t1.a<=>t2.a); +--sorted_result +select * from t2 left join t1 on (t1.a<=>t2.a); + +--sorted_result +select * from t1 union select * from t2; + +alter ignore table t2 force; + +drop table t1, t2; diff --git a/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.MYD b/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.MYD new file mode 100644 index 00000000000..138a08deeb7 Binary files /dev/null and b/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.MYD differ diff --git a/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.MYI b/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.MYI new file mode 100644 index 00000000000..6dde55b27da Binary files /dev/null and b/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.MYI differ diff --git a/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.frm b/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.frm new file mode 100644 index 00000000000..d03c730aff7 Binary files /dev/null and b/plugin/type_uuid/mysql-test/type_uuid/std_data/mdev-29959.frm differ 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 b3955d09735..0cb5402a40b 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result @@ -413,156 +413,6 @@ a 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000000 -00000001-0000-0000-0000-000000000000 -00000002-0000-0000-0000-000000000000 -00000003-0000-0000-0000-000000000000 -00000004-0000-0000-0000-000000000000 -00000005-0000-0000-0000-000000000000 -00000006-0000-0000-0000-000000000000 -00000007-0000-0000-0000-000000000000 -00000008-0000-0000-0000-000000000000 -00000009-0000-0000-0000-000000000000 -0000000a-0000-0000-0000-000000000000 -0000000b-0000-0000-0000-000000000000 -0000000c-0000-0000-0000-000000000000 -0000000d-0000-0000-0000-000000000000 -0000000e-0000-0000-0000-000000000000 -0000000f-0000-0000-0000-000000000000 -00000100-0000-0000-0000-000000000000 -00000200-0000-0000-0000-000000000000 -00000300-0000-0000-0000-000000000000 -00000400-0000-0000-0000-000000000000 -00000500-0000-0000-0000-000000000000 -00000600-0000-0000-0000-000000000000 -00000700-0000-0000-0000-000000000000 -00000800-0000-0000-0000-000000000000 -00000900-0000-0000-0000-000000000000 -00000a00-0000-0000-0000-000000000000 -00000b00-0000-0000-0000-000000000000 -00000c00-0000-0000-0000-000000000000 -00000d00-0000-0000-0000-000000000000 -00000e00-0000-0000-0000-000000000000 -00000f00-0000-0000-0000-000000000000 -00010000-0000-0000-0000-000000000000 -00020000-0000-0000-0000-000000000000 -00030000-0000-0000-0000-000000000000 -00040000-0000-0000-0000-000000000000 -00050000-0000-0000-0000-000000000000 -00060000-0000-0000-0000-000000000000 -00070000-0000-0000-0000-000000000000 -00080000-0000-0000-0000-000000000000 -00090000-0000-0000-0000-000000000000 -000a0000-0000-0000-0000-000000000000 -000b0000-0000-0000-0000-000000000000 -000c0000-0000-0000-0000-000000000000 -000d0000-0000-0000-0000-000000000000 -000e0000-0000-0000-0000-000000000000 -000f0000-0000-0000-0000-000000000000 -01000000-0000-0000-0000-000000000000 -02000000-0000-0000-0000-000000000000 -03000000-0000-0000-0000-000000000000 -04000000-0000-0000-0000-000000000000 -05000000-0000-0000-0000-000000000000 -06000000-0000-0000-0000-000000000000 -07000000-0000-0000-0000-000000000000 -08000000-0000-0000-0000-000000000000 -09000000-0000-0000-0000-000000000000 -0a000000-0000-0000-0000-000000000000 -0b000000-0000-0000-0000-000000000000 -0c000000-0000-0000-0000-000000000000 -0d000000-0000-0000-0000-000000000000 -0e000000-0000-0000-0000-000000000000 -0f000000-0000-0000-0000-000000000000 -00000000-0001-0000-0000-000000000000 -00000000-0002-0000-0000-000000000000 -00000000-0003-0000-0000-000000000000 -00000000-0004-0000-0000-000000000000 -00000000-0005-0000-0000-000000000000 -00000000-0006-0000-0000-000000000000 -00000000-0007-0000-0000-000000000000 -00000000-0008-0000-0000-000000000000 -00000000-0009-0000-0000-000000000000 -00000000-000a-0000-0000-000000000000 -00000000-000b-0000-0000-000000000000 -00000000-000c-0000-0000-000000000000 -00000000-000d-0000-0000-000000000000 -00000000-000e-0000-0000-000000000000 -00000000-000f-0000-0000-000000000000 -00000000-0100-0000-0000-000000000000 -00000000-0200-0000-0000-000000000000 -00000000-0300-0000-0000-000000000000 -00000000-0400-0000-0000-000000000000 -00000000-0500-0000-0000-000000000000 -00000000-0600-0000-0000-000000000000 -00000000-0700-0000-0000-000000000000 -00000000-0800-0000-0000-000000000000 -00000000-0900-0000-0000-000000000000 -00000000-0a00-0000-0000-000000000000 -00000000-0b00-0000-0000-000000000000 -00000000-0c00-0000-0000-000000000000 -00000000-0d00-0000-0000-000000000000 -00000000-0e00-0000-0000-000000000000 -00000000-0f00-0000-0000-000000000000 -00000000-0000-0001-0000-000000000000 -00000000-0000-0002-0000-000000000000 -00000000-0000-0003-0000-000000000000 -00000000-0000-0004-0000-000000000000 -00000000-0000-0005-0000-000000000000 -00000000-0000-0006-0000-000000000000 -00000000-0000-0007-0000-000000000000 -00000000-0000-0008-0000-000000000000 -00000000-0000-0009-0000-000000000000 -00000000-0000-000a-0000-000000000000 -00000000-0000-000b-0000-000000000000 -00000000-0000-000c-0000-000000000000 -00000000-0000-000d-0000-000000000000 -00000000-0000-000e-0000-000000000000 -00000000-0000-000f-0000-000000000000 -00000000-0000-0100-0000-000000000000 -00000000-0000-0200-0000-000000000000 -00000000-0000-0300-0000-000000000000 -00000000-0000-0400-0000-000000000000 -00000000-0000-0500-0000-000000000000 -00000000-0000-0600-0000-000000000000 -00000000-0000-0700-0000-000000000000 -00000000-0000-0800-0000-000000000000 -00000000-0000-0900-0000-000000000000 -00000000-0000-0a00-0000-000000000000 -00000000-0000-0b00-0000-000000000000 -00000000-0000-0c00-0000-000000000000 -00000000-0000-0d00-0000-000000000000 -00000000-0000-0e00-0000-000000000000 -00000000-0000-0f00-0000-000000000000 -00000000-0000-0000-0001-000000000000 -00000000-0000-0000-0002-000000000000 -00000000-0000-0000-0003-000000000000 -00000000-0000-0000-0004-000000000000 -00000000-0000-0000-0005-000000000000 -00000000-0000-0000-0006-000000000000 -00000000-0000-0000-0007-000000000000 -00000000-0000-0000-0008-000000000000 -00000000-0000-0000-0009-000000000000 -00000000-0000-0000-000a-000000000000 -00000000-0000-0000-000b-000000000000 -00000000-0000-0000-000c-000000000000 -00000000-0000-0000-000d-000000000000 -00000000-0000-0000-000e-000000000000 -00000000-0000-0000-000f-000000000000 -00000000-0000-0000-0100-000000000000 -00000000-0000-0000-0200-000000000000 -00000000-0000-0000-0300-000000000000 -00000000-0000-0000-0400-000000000000 -00000000-0000-0000-0500-000000000000 -00000000-0000-0000-0600-000000000000 -00000000-0000-0000-0700-000000000000 -00000000-0000-0000-0800-000000000000 -00000000-0000-0000-0900-000000000000 -00000000-0000-0000-0a00-000000000000 -00000000-0000-0000-0b00-000000000000 -00000000-0000-0000-0c00-000000000000 -00000000-0000-0000-0d00-000000000000 -00000000-0000-0000-0e00-000000000000 -00000000-0000-0000-0f00-000000000000 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000003 @@ -653,6 +503,156 @@ a 00000000-0000-0000-0000-0d0000000000 00000000-0000-0000-0000-0e0000000000 00000000-0000-0000-0000-0f0000000000 +00000000-0000-0000-0001-000000000000 +00000000-0000-0000-0002-000000000000 +00000000-0000-0000-0003-000000000000 +00000000-0000-0000-0004-000000000000 +00000000-0000-0000-0005-000000000000 +00000000-0000-0000-0006-000000000000 +00000000-0000-0000-0007-000000000000 +00000000-0000-0000-0008-000000000000 +00000000-0000-0000-0009-000000000000 +00000000-0000-0000-000a-000000000000 +00000000-0000-0000-000b-000000000000 +00000000-0000-0000-000c-000000000000 +00000000-0000-0000-000d-000000000000 +00000000-0000-0000-000e-000000000000 +00000000-0000-0000-000f-000000000000 +00000000-0000-0000-0100-000000000000 +00000000-0000-0000-0200-000000000000 +00000000-0000-0000-0300-000000000000 +00000000-0000-0000-0400-000000000000 +00000000-0000-0000-0500-000000000000 +00000000-0000-0000-0600-000000000000 +00000000-0000-0000-0700-000000000000 +00000000-0000-0000-0800-000000000000 +00000000-0000-0000-0900-000000000000 +00000000-0000-0000-0a00-000000000000 +00000000-0000-0000-0b00-000000000000 +00000000-0000-0000-0c00-000000000000 +00000000-0000-0000-0d00-000000000000 +00000000-0000-0000-0e00-000000000000 +00000000-0000-0000-0f00-000000000000 +00000000-0000-0001-0000-000000000000 +00000000-0000-0002-0000-000000000000 +00000000-0000-0003-0000-000000000000 +00000000-0000-0004-0000-000000000000 +00000000-0000-0005-0000-000000000000 +00000000-0000-0006-0000-000000000000 +00000000-0000-0007-0000-000000000000 +00000000-0000-0008-0000-000000000000 +00000000-0000-0009-0000-000000000000 +00000000-0000-000a-0000-000000000000 +00000000-0000-000b-0000-000000000000 +00000000-0000-000c-0000-000000000000 +00000000-0000-000d-0000-000000000000 +00000000-0000-000e-0000-000000000000 +00000000-0000-000f-0000-000000000000 +00000000-0000-0100-0000-000000000000 +00000000-0000-0200-0000-000000000000 +00000000-0000-0300-0000-000000000000 +00000000-0000-0400-0000-000000000000 +00000000-0000-0500-0000-000000000000 +00000000-0000-0600-0000-000000000000 +00000000-0000-0700-0000-000000000000 +00000000-0000-0800-0000-000000000000 +00000000-0000-0900-0000-000000000000 +00000000-0000-0a00-0000-000000000000 +00000000-0000-0b00-0000-000000000000 +00000000-0000-0c00-0000-000000000000 +00000000-0000-0d00-0000-000000000000 +00000000-0000-0e00-0000-000000000000 +00000000-0000-0f00-0000-000000000000 +00000000-0001-0000-0000-000000000000 +00000000-0002-0000-0000-000000000000 +00000000-0003-0000-0000-000000000000 +00000000-0004-0000-0000-000000000000 +00000000-0005-0000-0000-000000000000 +00000000-0006-0000-0000-000000000000 +00000000-0007-0000-0000-000000000000 +00000000-0008-0000-0000-000000000000 +00000000-0009-0000-0000-000000000000 +00000000-000a-0000-0000-000000000000 +00000000-000b-0000-0000-000000000000 +00000000-000c-0000-0000-000000000000 +00000000-000d-0000-0000-000000000000 +00000000-000e-0000-0000-000000000000 +00000000-000f-0000-0000-000000000000 +00000000-0100-0000-0000-000000000000 +00000000-0200-0000-0000-000000000000 +00000000-0300-0000-0000-000000000000 +00000000-0400-0000-0000-000000000000 +00000000-0500-0000-0000-000000000000 +00000000-0600-0000-0000-000000000000 +00000000-0700-0000-0000-000000000000 +00000000-0800-0000-0000-000000000000 +00000000-0900-0000-0000-000000000000 +00000000-0a00-0000-0000-000000000000 +00000000-0b00-0000-0000-000000000000 +00000000-0c00-0000-0000-000000000000 +00000000-0d00-0000-0000-000000000000 +00000000-0e00-0000-0000-000000000000 +00000000-0f00-0000-0000-000000000000 +00000001-0000-0000-0000-000000000000 +00000002-0000-0000-0000-000000000000 +00000003-0000-0000-0000-000000000000 +00000004-0000-0000-0000-000000000000 +00000005-0000-0000-0000-000000000000 +00000006-0000-0000-0000-000000000000 +00000007-0000-0000-0000-000000000000 +00000008-0000-0000-0000-000000000000 +00000009-0000-0000-0000-000000000000 +0000000a-0000-0000-0000-000000000000 +0000000b-0000-0000-0000-000000000000 +0000000c-0000-0000-0000-000000000000 +0000000d-0000-0000-0000-000000000000 +0000000e-0000-0000-0000-000000000000 +0000000f-0000-0000-0000-000000000000 +00000100-0000-0000-0000-000000000000 +00000200-0000-0000-0000-000000000000 +00000300-0000-0000-0000-000000000000 +00000400-0000-0000-0000-000000000000 +00000500-0000-0000-0000-000000000000 +00000600-0000-0000-0000-000000000000 +00000700-0000-0000-0000-000000000000 +00000800-0000-0000-0000-000000000000 +00000900-0000-0000-0000-000000000000 +00000a00-0000-0000-0000-000000000000 +00000b00-0000-0000-0000-000000000000 +00000c00-0000-0000-0000-000000000000 +00000d00-0000-0000-0000-000000000000 +00000e00-0000-0000-0000-000000000000 +00000f00-0000-0000-0000-000000000000 +00010000-0000-0000-0000-000000000000 +00020000-0000-0000-0000-000000000000 +00030000-0000-0000-0000-000000000000 +00040000-0000-0000-0000-000000000000 +00050000-0000-0000-0000-000000000000 +00060000-0000-0000-0000-000000000000 +00070000-0000-0000-0000-000000000000 +00080000-0000-0000-0000-000000000000 +00090000-0000-0000-0000-000000000000 +000a0000-0000-0000-0000-000000000000 +000b0000-0000-0000-0000-000000000000 +000c0000-0000-0000-0000-000000000000 +000d0000-0000-0000-0000-000000000000 +000e0000-0000-0000-0000-000000000000 +000f0000-0000-0000-0000-000000000000 +01000000-0000-0000-0000-000000000000 +02000000-0000-0000-0000-000000000000 +03000000-0000-0000-0000-000000000000 +04000000-0000-0000-0000-000000000000 +05000000-0000-0000-0000-000000000000 +06000000-0000-0000-0000-000000000000 +07000000-0000-0000-0000-000000000000 +08000000-0000-0000-0000-000000000000 +09000000-0000-0000-0000-000000000000 +0a000000-0000-0000-0000-000000000000 +0b000000-0000-0000-0000-000000000000 +0c000000-0000-0000-0000-000000000000 +0d000000-0000-0000-0000-000000000000 +0e000000-0000-0000-0000-000000000000 +0f000000-0000-0000-0000-000000000000 SELECT COALESCE(NULL, a) FROM t1 ORDER BY a; COALESCE(NULL, a) 00000000-0000-0000-0000-000000000000 @@ -671,156 +671,6 @@ COALESCE(NULL, a) 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000000 00000000-0000-0000-0000-000000000000 -00000001-0000-0000-0000-000000000000 -00000002-0000-0000-0000-000000000000 -00000003-0000-0000-0000-000000000000 -00000004-0000-0000-0000-000000000000 -00000005-0000-0000-0000-000000000000 -00000006-0000-0000-0000-000000000000 -00000007-0000-0000-0000-000000000000 -00000008-0000-0000-0000-000000000000 -00000009-0000-0000-0000-000000000000 -0000000a-0000-0000-0000-000000000000 -0000000b-0000-0000-0000-000000000000 -0000000c-0000-0000-0000-000000000000 -0000000d-0000-0000-0000-000000000000 -0000000e-0000-0000-0000-000000000000 -0000000f-0000-0000-0000-000000000000 -00000100-0000-0000-0000-000000000000 -00000200-0000-0000-0000-000000000000 -00000300-0000-0000-0000-000000000000 -00000400-0000-0000-0000-000000000000 -00000500-0000-0000-0000-000000000000 -00000600-0000-0000-0000-000000000000 -00000700-0000-0000-0000-000000000000 -00000800-0000-0000-0000-000000000000 -00000900-0000-0000-0000-000000000000 -00000a00-0000-0000-0000-000000000000 -00000b00-0000-0000-0000-000000000000 -00000c00-0000-0000-0000-000000000000 -00000d00-0000-0000-0000-000000000000 -00000e00-0000-0000-0000-000000000000 -00000f00-0000-0000-0000-000000000000 -00010000-0000-0000-0000-000000000000 -00020000-0000-0000-0000-000000000000 -00030000-0000-0000-0000-000000000000 -00040000-0000-0000-0000-000000000000 -00050000-0000-0000-0000-000000000000 -00060000-0000-0000-0000-000000000000 -00070000-0000-0000-0000-000000000000 -00080000-0000-0000-0000-000000000000 -00090000-0000-0000-0000-000000000000 -000a0000-0000-0000-0000-000000000000 -000b0000-0000-0000-0000-000000000000 -000c0000-0000-0000-0000-000000000000 -000d0000-0000-0000-0000-000000000000 -000e0000-0000-0000-0000-000000000000 -000f0000-0000-0000-0000-000000000000 -01000000-0000-0000-0000-000000000000 -02000000-0000-0000-0000-000000000000 -03000000-0000-0000-0000-000000000000 -04000000-0000-0000-0000-000000000000 -05000000-0000-0000-0000-000000000000 -06000000-0000-0000-0000-000000000000 -07000000-0000-0000-0000-000000000000 -08000000-0000-0000-0000-000000000000 -09000000-0000-0000-0000-000000000000 -0a000000-0000-0000-0000-000000000000 -0b000000-0000-0000-0000-000000000000 -0c000000-0000-0000-0000-000000000000 -0d000000-0000-0000-0000-000000000000 -0e000000-0000-0000-0000-000000000000 -0f000000-0000-0000-0000-000000000000 -00000000-0001-0000-0000-000000000000 -00000000-0002-0000-0000-000000000000 -00000000-0003-0000-0000-000000000000 -00000000-0004-0000-0000-000000000000 -00000000-0005-0000-0000-000000000000 -00000000-0006-0000-0000-000000000000 -00000000-0007-0000-0000-000000000000 -00000000-0008-0000-0000-000000000000 -00000000-0009-0000-0000-000000000000 -00000000-000a-0000-0000-000000000000 -00000000-000b-0000-0000-000000000000 -00000000-000c-0000-0000-000000000000 -00000000-000d-0000-0000-000000000000 -00000000-000e-0000-0000-000000000000 -00000000-000f-0000-0000-000000000000 -00000000-0100-0000-0000-000000000000 -00000000-0200-0000-0000-000000000000 -00000000-0300-0000-0000-000000000000 -00000000-0400-0000-0000-000000000000 -00000000-0500-0000-0000-000000000000 -00000000-0600-0000-0000-000000000000 -00000000-0700-0000-0000-000000000000 -00000000-0800-0000-0000-000000000000 -00000000-0900-0000-0000-000000000000 -00000000-0a00-0000-0000-000000000000 -00000000-0b00-0000-0000-000000000000 -00000000-0c00-0000-0000-000000000000 -00000000-0d00-0000-0000-000000000000 -00000000-0e00-0000-0000-000000000000 -00000000-0f00-0000-0000-000000000000 -00000000-0000-0001-0000-000000000000 -00000000-0000-0002-0000-000000000000 -00000000-0000-0003-0000-000000000000 -00000000-0000-0004-0000-000000000000 -00000000-0000-0005-0000-000000000000 -00000000-0000-0006-0000-000000000000 -00000000-0000-0007-0000-000000000000 -00000000-0000-0008-0000-000000000000 -00000000-0000-0009-0000-000000000000 -00000000-0000-000a-0000-000000000000 -00000000-0000-000b-0000-000000000000 -00000000-0000-000c-0000-000000000000 -00000000-0000-000d-0000-000000000000 -00000000-0000-000e-0000-000000000000 -00000000-0000-000f-0000-000000000000 -00000000-0000-0100-0000-000000000000 -00000000-0000-0200-0000-000000000000 -00000000-0000-0300-0000-000000000000 -00000000-0000-0400-0000-000000000000 -00000000-0000-0500-0000-000000000000 -00000000-0000-0600-0000-000000000000 -00000000-0000-0700-0000-000000000000 -00000000-0000-0800-0000-000000000000 -00000000-0000-0900-0000-000000000000 -00000000-0000-0a00-0000-000000000000 -00000000-0000-0b00-0000-000000000000 -00000000-0000-0c00-0000-000000000000 -00000000-0000-0d00-0000-000000000000 -00000000-0000-0e00-0000-000000000000 -00000000-0000-0f00-0000-000000000000 -00000000-0000-0000-0001-000000000000 -00000000-0000-0000-0002-000000000000 -00000000-0000-0000-0003-000000000000 -00000000-0000-0000-0004-000000000000 -00000000-0000-0000-0005-000000000000 -00000000-0000-0000-0006-000000000000 -00000000-0000-0000-0007-000000000000 -00000000-0000-0000-0008-000000000000 -00000000-0000-0000-0009-000000000000 -00000000-0000-0000-000a-000000000000 -00000000-0000-0000-000b-000000000000 -00000000-0000-0000-000c-000000000000 -00000000-0000-0000-000d-000000000000 -00000000-0000-0000-000e-000000000000 -00000000-0000-0000-000f-000000000000 -00000000-0000-0000-0100-000000000000 -00000000-0000-0000-0200-000000000000 -00000000-0000-0000-0300-000000000000 -00000000-0000-0000-0400-000000000000 -00000000-0000-0000-0500-000000000000 -00000000-0000-0000-0600-000000000000 -00000000-0000-0000-0700-000000000000 -00000000-0000-0000-0800-000000000000 -00000000-0000-0000-0900-000000000000 -00000000-0000-0000-0a00-000000000000 -00000000-0000-0000-0b00-000000000000 -00000000-0000-0000-0c00-000000000000 -00000000-0000-0000-0d00-000000000000 -00000000-0000-0000-0e00-000000000000 -00000000-0000-0000-0f00-000000000000 00000000-0000-0000-0000-000000000001 00000000-0000-0000-0000-000000000002 00000000-0000-0000-0000-000000000003 @@ -911,6 +761,156 @@ COALESCE(NULL, a) 00000000-0000-0000-0000-0d0000000000 00000000-0000-0000-0000-0e0000000000 00000000-0000-0000-0000-0f0000000000 +00000000-0000-0000-0001-000000000000 +00000000-0000-0000-0002-000000000000 +00000000-0000-0000-0003-000000000000 +00000000-0000-0000-0004-000000000000 +00000000-0000-0000-0005-000000000000 +00000000-0000-0000-0006-000000000000 +00000000-0000-0000-0007-000000000000 +00000000-0000-0000-0008-000000000000 +00000000-0000-0000-0009-000000000000 +00000000-0000-0000-000a-000000000000 +00000000-0000-0000-000b-000000000000 +00000000-0000-0000-000c-000000000000 +00000000-0000-0000-000d-000000000000 +00000000-0000-0000-000e-000000000000 +00000000-0000-0000-000f-000000000000 +00000000-0000-0000-0100-000000000000 +00000000-0000-0000-0200-000000000000 +00000000-0000-0000-0300-000000000000 +00000000-0000-0000-0400-000000000000 +00000000-0000-0000-0500-000000000000 +00000000-0000-0000-0600-000000000000 +00000000-0000-0000-0700-000000000000 +00000000-0000-0000-0800-000000000000 +00000000-0000-0000-0900-000000000000 +00000000-0000-0000-0a00-000000000000 +00000000-0000-0000-0b00-000000000000 +00000000-0000-0000-0c00-000000000000 +00000000-0000-0000-0d00-000000000000 +00000000-0000-0000-0e00-000000000000 +00000000-0000-0000-0f00-000000000000 +00000000-0000-0001-0000-000000000000 +00000000-0000-0002-0000-000000000000 +00000000-0000-0003-0000-000000000000 +00000000-0000-0004-0000-000000000000 +00000000-0000-0005-0000-000000000000 +00000000-0000-0006-0000-000000000000 +00000000-0000-0007-0000-000000000000 +00000000-0000-0008-0000-000000000000 +00000000-0000-0009-0000-000000000000 +00000000-0000-000a-0000-000000000000 +00000000-0000-000b-0000-000000000000 +00000000-0000-000c-0000-000000000000 +00000000-0000-000d-0000-000000000000 +00000000-0000-000e-0000-000000000000 +00000000-0000-000f-0000-000000000000 +00000000-0000-0100-0000-000000000000 +00000000-0000-0200-0000-000000000000 +00000000-0000-0300-0000-000000000000 +00000000-0000-0400-0000-000000000000 +00000000-0000-0500-0000-000000000000 +00000000-0000-0600-0000-000000000000 +00000000-0000-0700-0000-000000000000 +00000000-0000-0800-0000-000000000000 +00000000-0000-0900-0000-000000000000 +00000000-0000-0a00-0000-000000000000 +00000000-0000-0b00-0000-000000000000 +00000000-0000-0c00-0000-000000000000 +00000000-0000-0d00-0000-000000000000 +00000000-0000-0e00-0000-000000000000 +00000000-0000-0f00-0000-000000000000 +00000000-0001-0000-0000-000000000000 +00000000-0002-0000-0000-000000000000 +00000000-0003-0000-0000-000000000000 +00000000-0004-0000-0000-000000000000 +00000000-0005-0000-0000-000000000000 +00000000-0006-0000-0000-000000000000 +00000000-0007-0000-0000-000000000000 +00000000-0008-0000-0000-000000000000 +00000000-0009-0000-0000-000000000000 +00000000-000a-0000-0000-000000000000 +00000000-000b-0000-0000-000000000000 +00000000-000c-0000-0000-000000000000 +00000000-000d-0000-0000-000000000000 +00000000-000e-0000-0000-000000000000 +00000000-000f-0000-0000-000000000000 +00000000-0100-0000-0000-000000000000 +00000000-0200-0000-0000-000000000000 +00000000-0300-0000-0000-000000000000 +00000000-0400-0000-0000-000000000000 +00000000-0500-0000-0000-000000000000 +00000000-0600-0000-0000-000000000000 +00000000-0700-0000-0000-000000000000 +00000000-0800-0000-0000-000000000000 +00000000-0900-0000-0000-000000000000 +00000000-0a00-0000-0000-000000000000 +00000000-0b00-0000-0000-000000000000 +00000000-0c00-0000-0000-000000000000 +00000000-0d00-0000-0000-000000000000 +00000000-0e00-0000-0000-000000000000 +00000000-0f00-0000-0000-000000000000 +00000001-0000-0000-0000-000000000000 +00000002-0000-0000-0000-000000000000 +00000003-0000-0000-0000-000000000000 +00000004-0000-0000-0000-000000000000 +00000005-0000-0000-0000-000000000000 +00000006-0000-0000-0000-000000000000 +00000007-0000-0000-0000-000000000000 +00000008-0000-0000-0000-000000000000 +00000009-0000-0000-0000-000000000000 +0000000a-0000-0000-0000-000000000000 +0000000b-0000-0000-0000-000000000000 +0000000c-0000-0000-0000-000000000000 +0000000d-0000-0000-0000-000000000000 +0000000e-0000-0000-0000-000000000000 +0000000f-0000-0000-0000-000000000000 +00000100-0000-0000-0000-000000000000 +00000200-0000-0000-0000-000000000000 +00000300-0000-0000-0000-000000000000 +00000400-0000-0000-0000-000000000000 +00000500-0000-0000-0000-000000000000 +00000600-0000-0000-0000-000000000000 +00000700-0000-0000-0000-000000000000 +00000800-0000-0000-0000-000000000000 +00000900-0000-0000-0000-000000000000 +00000a00-0000-0000-0000-000000000000 +00000b00-0000-0000-0000-000000000000 +00000c00-0000-0000-0000-000000000000 +00000d00-0000-0000-0000-000000000000 +00000e00-0000-0000-0000-000000000000 +00000f00-0000-0000-0000-000000000000 +00010000-0000-0000-0000-000000000000 +00020000-0000-0000-0000-000000000000 +00030000-0000-0000-0000-000000000000 +00040000-0000-0000-0000-000000000000 +00050000-0000-0000-0000-000000000000 +00060000-0000-0000-0000-000000000000 +00070000-0000-0000-0000-000000000000 +00080000-0000-0000-0000-000000000000 +00090000-0000-0000-0000-000000000000 +000a0000-0000-0000-0000-000000000000 +000b0000-0000-0000-0000-000000000000 +000c0000-0000-0000-0000-000000000000 +000d0000-0000-0000-0000-000000000000 +000e0000-0000-0000-0000-000000000000 +000f0000-0000-0000-0000-000000000000 +01000000-0000-0000-0000-000000000000 +02000000-0000-0000-0000-000000000000 +03000000-0000-0000-0000-000000000000 +04000000-0000-0000-0000-000000000000 +05000000-0000-0000-0000-000000000000 +06000000-0000-0000-0000-000000000000 +07000000-0000-0000-0000-000000000000 +08000000-0000-0000-0000-000000000000 +09000000-0000-0000-0000-000000000000 +0a000000-0000-0000-0000-000000000000 +0b000000-0000-0000-0000-000000000000 +0c000000-0000-0000-0000-000000000000 +0d000000-0000-0000-0000-000000000000 +0e000000-0000-0000-0000-000000000000 +0f000000-0000-0000-0000-000000000000 # # Lexicographical ORDER BY # @@ -1659,10 +1659,10 @@ INSERT INTO t1 VALUES (CAST(CONCAT('2','0000000-0000-0000-0000-000000000003') AS SELECT * FROM t1 ORDER BY a; a 10000000-0000-0000-0000-000000000001 -20000000-0000-0000-0000-000000000001 10000000-0000-0000-0000-000000000002 -20000000-0000-0000-0000-000000000002 10000000-0000-0000-0000-000000000003 +20000000-0000-0000-0000-000000000001 +20000000-0000-0000-0000-000000000002 20000000-0000-0000-0000-000000000003 DROP TABLE t1; # @@ -3178,8 +3178,8 @@ 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 +11111111-0000-0000-0000-000000000000 SELECT * FROM t1 WHERE d <= ALL (SELECT * FROM t1); d 11111111-0000-0000-0000-000000000000 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 f2a1e27d0d0..21086fef2cb 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 @@ -25,7 +25,7 @@ a 00000000-0000-0000-0000-0000000000ff EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 17 const 4 Using where +1 SIMPLE t1 ref a a 17 const 2 Using where SELECT * FROM t1 WHERE a='garbage'; a Warnings: @@ -66,7 +66,7 @@ EXPLAIN SELECT * FROM t1 WHERE a IN '00000000-0000-0000-0000-0000000000f0' ); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 17 NULL 12 Using where +1 SIMPLE t1 range a a 17 NULL 6 Using where SELECT * FROM t1 WHERE a IN ( '00000000-0000-0000-0000-000000000080', @@ -85,7 +85,7 @@ EXPLAIN SELECT * FROM t1 WHERE a IN 'garbage' ); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 17 NULL 8 Using where +1 SIMPLE t1 range a a 17 NULL 4 Using where Warnings: Warning 1292 Incorrect uuid value: 'garbage' SELECT * FROM t1 WHERE a BETWEEN @@ -178,7 +178,7 @@ a 00000000-0000-0000-0000-0000000000ff EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref a a 17 const 4 100.00 Using where +1 SIMPLE t1 ref a a 17 const 2 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-0000000000ff' DROP TABLE t1; 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 8df2c85ae48..736aea4555f 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 @@ -25,7 +25,7 @@ a 00000000-0000-0000-0000-0000000000ff EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref a a 17 const 1 Using where; Using index +1 SIMPLE t1 ref a a 17 const 7 Using where; Using index SELECT * FROM t1 WHERE a='garbage'; a Warnings: @@ -41,7 +41,7 @@ a 00000000-0000-0000-0000-0000000000ff EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 17 NULL 3 Using where; Using index +1 SIMPLE t1 range a a 17 NULL 28 Using where; Using index SELECT * FROM t1 WHERE a>='garbage'; a EXPLAIN SELECT * FROM t1 WHERE a>='garbage'; @@ -64,7 +64,7 @@ EXPLAIN SELECT * FROM t1 WHERE a IN '00000000-0000-0000-0000-0000000000f0' ); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 17 NULL 4 Using where; Using index +1 SIMPLE t1 range a a 17 NULL 3 Using where; Using index SELECT * FROM t1 WHERE a IN ( '00000000-0000-0000-0000-000000000080', @@ -96,7 +96,7 @@ EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '00000000-0000-0000-0000-000000000080' AND '00000000-0000-0000-0000-000000000081'; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index +1 SIMPLE t1 range a a 17 NULL 1 Using where; Using index SELECT * FROM t1 WHERE a BETWEEN '00000000-0000-0000-0000-000000000080' AND 'garbage'; @@ -111,7 +111,7 @@ a 00000000-0000-0000-0000-0000000000ff EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref a a 17 const 1 100.00 Using where; Using index +1 SIMPLE t1 ref a a 17 const 7 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = UUID'00000000-0000-0000-0000-0000000000ff' DROP TABLE t1; diff --git a/plugin/type_uuid/plugin.cc b/plugin/type_uuid/plugin.cc index bd320a9a897..499019e948c 100644 --- a/plugin/type_uuid/plugin.cc +++ b/plugin/type_uuid/plugin.cc @@ -21,12 +21,83 @@ #include #include +/* + The whole purpose of this Type_handler_uuid_dispatcher is to choose + whether the field should use Type_handler_uuid_new or Type_handler_uuid_old + based on the version of MariaDB that created the table. + When created every field will use either Type_handler_uuid_new or _old. + Literals and functions always use _new. +*/ +class Type_handler_uuid_dispatcher: public Type_handler_uuid_new +{ +public: + Field *make_table_field_from_def(TABLE_SHARE *share, MEM_ROOT *root, + const LEX_CSTRING *name, const Record_addr &addr, + const Bit_addr &bit, + const Column_definition_attributes *attr, + uint32 flags) const override + { + bool new_uuid= share->mysql_version == 0 || + (share->mysql_version >= 100908 && share->mysql_version < 100999) || + (share->mysql_version >= 101006 && share->mysql_version < 101099) || + (share->mysql_version >= 101105 && share->mysql_version < 101199) || + (share->mysql_version >= 110003 && share->mysql_version < 110099) || + (share->mysql_version >= 110102 && share->mysql_version < 110199) || + share->mysql_version >= 110201; + static Type_handler *th[]= { + Type_handler_uuid_old::singleton(), Type_handler_uuid_new::singleton() + }; + return th[new_uuid]-> + make_table_field_from_def(share, root, name, addr, bit, attr, flags); + } +}; + +static Type_handler_uuid_dispatcher type_handler_uuid_dispatcher; + static struct st_mariadb_data_type plugin_descriptor_type_uuid= { MariaDB_DATA_TYPE_INTERFACE_VERSION, - UUIDBundle::type_handler_fbt() + &type_handler_uuid_dispatcher }; + +const Type_handler *Type_collection_uuid::find_in_array(const Type_handler *a, + const Type_handler *b, + bool for_cmp) const +{ + if (a == b) return a; + + /* + in the search below we'll find if we can convert `b` to `a`. + So, if one of the arguments is uuid and the other is not, + we should put uuid type in `a` and not-uuid in `b`. And if one type is + new uuid and the other is old uuid, new uuid should be in `a` + */ + if (a != Type_handler_uuid_new::singleton() && b->type_collection() == this) + std::swap(a, b); + + DBUG_ASSERT(a != &type_handler_uuid_dispatcher); + DBUG_ASSERT(b != &type_handler_uuid_dispatcher); + + /* + Search in the array for an element, equal to `b`. + If found - return `a`, if not found - return NULL. + Array is terminated by `a`. + */ + static const Type_handler *arr[]={ &type_handler_varchar, + &type_handler_string, &type_handler_tiny_blob, &type_handler_blob, + &type_handler_medium_blob, &type_handler_hex_hybrid, + // in aggregate_for_comparison() all types above cannot happen, + // so we'll start the search from here: + &type_handler_null, &type_handler_long_blob, + Type_handler_uuid_old::singleton(), Type_handler_uuid_new::singleton() }; + + for (int i= for_cmp ? 6 : 0; arr[i] != a; i++) + if (arr[i] == b) + return a; + return NULL; +} + /*************************************************************************/ class Create_func_uuid : public Create_func_arg0 @@ -71,17 +142,26 @@ static Plugin_function plugin_descriptor_function_uuid(&Create_func_uuid::s_singleton), plugin_descriptor_function_sys_guid(&Create_func_sys_guid::s_singleton); +static constexpr Name type_name={STRING_WITH_LEN("uuid")}; + +int uuid_init(void*) +{ + Type_handler_uuid_new::singleton()->set_name(type_name); + Type_handler_uuid_old::singleton()->set_name(type_name); + return 0; +} + /*************************************************************************/ maria_declare_plugin(type_uuid) { MariaDB_DATA_TYPE_PLUGIN, // the plugin type (see include/mysql/plugin.h) &plugin_descriptor_type_uuid, // pointer to type-specific plugin descriptor - "uuid", // plugin name + type_name.ptr(), // plugin name "MariaDB Corporation", // plugin author "Data type UUID", // the plugin description PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h) - 0, // Pointer to plugin initialization function + uuid_init, // Pointer to plugin initialization function 0, // Pointer to plugin deinitialization function 0x0100, // Numeric version 0xAABB means AA.BB version NULL, // Status variables diff --git a/plugin/type_uuid/sql_type_uuid.cc b/plugin/type_uuid/sql_type_uuid.cc deleted file mode 100644 index 9b4a731dbb2..00000000000 --- a/plugin/type_uuid/sql_type_uuid.cc +++ /dev/null @@ -1,117 +0,0 @@ -/* 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 St, Fifth Floor, Boston, MA 02110-1335 USA */ - -#define MYSQL_SERVER -#include "mariadb.h" -#include "my_net.h" -#include "sql_class.h" // THD, SORT_FIELD_ATTR -#include "opt_range.h" // SEL_ARG -#include "sql_type_uuid.h" - - -static bool get_digit(char ch, uint *val) -{ - if (ch >= '0' && ch <= '9') - { - *val= (uint) ch - '0'; - return false; - } - if (ch >= 'a' && ch <= 'f') - { - *val= (uint) ch - 'a' + 0x0a; - return false; - } - if (ch >= 'A' && ch <= 'F') - { - *val= (uint) ch - 'A' + 0x0a; - return false; - } - return true; -} - - -static bool get_digit(uint *val, const char *str, const char *end) -{ - if (str >= end) - return true; - return get_digit(*str, val); -} - - -static size_t skip_hyphens(const char *str, const char *end) -{ - const char *str0= str; - for ( ; str < end; str++) - { - if (str[0] != '-') - break; - } - return str - str0; -} - - -static const char *get_two_digits(char *val, const char *str, const char *end) -{ - uint hi, lo; - if (get_digit(&hi, str++, end)) - return NULL; - str+= skip_hyphens(str, end); - if (get_digit(&lo, str++, end)) - return NULL; - *val= (char) ((hi << 4) + lo); - return str; -} - - -bool UUID::ascii_to_fbt(const char *str, size_t str_length) -{ - const char *end= str + str_length; - /* - The format understood: - - Hyphen is not allowed on the first and the last position. - - Otherwise, hyphens are allowed on any (odd and even) position, - with any amount. - */ - if (str_length < 32) - goto err; - - for (uint oidx= 0; oidx < binary_length(); oidx++) - { - if (!(str= get_two_digits(&m_buffer[oidx], str, end))) - goto err; - // Allow hypheps after two digits, but not after the last digit - if (oidx + 1 < binary_length()) - str+= skip_hyphens(str, end); - } - if (str < end) - goto err; // Some input left - return false; -err: - bzero(m_buffer, sizeof(m_buffer)); - return true; -} - -size_t UUID::to_string(char *dst, size_t dstsize) const -{ - my_uuid2str((const uchar *) m_buffer, dst, 1); - return MY_UUID_STRING_LENGTH; -} - - -const Name &UUID::default_value() -{ - static Name def(STRING_WITH_LEN("00000000-0000-0000-0000-000000000000")); - return def; -} diff --git a/plugin/type_uuid/sql_type_uuid.h b/plugin/type_uuid/sql_type_uuid.h index ee39f542f05..272898efc8c 100644 --- a/plugin/type_uuid/sql_type_uuid.h +++ b/plugin/type_uuid/sql_type_uuid.h @@ -17,13 +17,103 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ #include "sql_type_fixedbin_storage.h" + +template class UUID: public FixedBinTypeStorage { + bool get_digit(char ch, uint *val) + { + if (ch >= '0' && ch <= '9') + { + *val= (uint) ch - '0'; + return false; + } + if (ch >= 'a' && ch <= 'f') + { + *val= (uint) ch - 'a' + 0x0a; + return false; + } + if (ch >= 'A' && ch <= 'F') + { + *val= (uint) ch - 'A' + 0x0a; + return false; + } + return true; + } + + bool get_digit(uint *val, const char *str, const char *end) + { + if (str >= end) + return true; + return get_digit(*str, val); + } + + size_t skip_hyphens(const char *str, const char *end) + { + const char *str0= str; + for ( ; str < end; str++) + { + if (str[0] != '-') + break; + } + return str - str0; + } + + const char *get_two_digits(char *val, const char *str, const char *end) + { + uint hi, lo; + if (get_digit(&hi, str++, end)) + return NULL; + str+= skip_hyphens(str, end); + if (get_digit(&lo, str++, end)) + return NULL; + *val= (char) ((hi << 4) + lo); + return str; + } + public: using FixedBinTypeStorage::FixedBinTypeStorage; - bool ascii_to_fbt(const char *str, size_t str_length); - size_t to_string(char *dst, size_t dstsize) const; - static const Name &default_value(); + bool ascii_to_fbt(const char *str, size_t str_length) + { + const char *end= str + str_length; + /* + The format understood: + - Hyphen is not allowed on the first and the last position. + - Otherwise, hyphens are allowed on any (odd and even) position, + with any amount. + */ + if (str_length < 32) + goto err; + + for (uint oidx= 0; oidx < binary_length(); oidx++) + { + if (!(str= get_two_digits(&m_buffer[oidx], str, end))) + goto err; + // Allow hypheps after two digits, but not after the last digit + if (oidx + 1 < binary_length()) + str+= skip_hyphens(str, end); + } + if (str < end) + goto err; // Some input left + if (m_buffer[6] & -m_buffer[8] & 0x80) + goto err; // impossible combination: version >= 8, variant = 0 + return false; + err: + bzero(m_buffer, sizeof(m_buffer)); + return true; + } + + size_t to_string(char *dst, size_t dstsize) const + { + my_uuid2str((const uchar *) m_buffer, dst, 1); + return MY_UUID_STRING_LENGTH; + } + + static const Name &default_value() + { + static Name def(STRING_WITH_LEN("00000000-0000-0000-0000-000000000000")); + return def; + } /* Binary (in-memory) UUIDv1 representation: @@ -86,21 +176,31 @@ public: // Convert the in-memory representation to the in-record representation static void memory_to_record(char *to, const char *from) { - segment(0).memory_to_record(to, from); - segment(1).memory_to_record(to, from); - segment(2).memory_to_record(to, from); - segment(3).memory_to_record(to, from); - segment(4).memory_to_record(to, from); + if (force_swap || (from[6] > 0 && from[6] < 0x60 && from[8] & 0x80)) + { + segment(0).memory_to_record(to, from); + segment(1).memory_to_record(to, from); + segment(2).memory_to_record(to, from); + segment(3).memory_to_record(to, from); + segment(4).memory_to_record(to, from); + } + else + memcpy(to, from, binary_length()); } // Convert the in-record representation to the in-memory representation static void record_to_memory(char *to, const char *from) { - segment(0).record_to_memory(to, from); - segment(1).record_to_memory(to, from); - segment(2).record_to_memory(to, from); - segment(3).record_to_memory(to, from); - segment(4).record_to_memory(to, from); + if (force_swap || (from[6] & -from[8] & 0x80)) + { + segment(0).record_to_memory(to, from); + segment(1).record_to_memory(to, from); + segment(2).record_to_memory(to, from); + segment(3).record_to_memory(to, from); + segment(4).record_to_memory(to, from); + } + else + memcpy(to, from, binary_length()); } /* @@ -179,8 +279,38 @@ public: }; +class Type_collection_uuid: public Type_collection +{ + const Type_handler *find_in_array(const Type_handler *what, + const Type_handler *stop, + bool for_comparison) const; +public: + const Type_handler *aggregate_for_result(const Type_handler *a, + const Type_handler *b) + const override + { return find_in_array(a, b, false); } + const Type_handler *aggregate_for_min_max(const Type_handler *a, + const Type_handler *b) + const override + { return find_in_array(a, b, false); } + const Type_handler *aggregate_for_comparison(const Type_handler *a, + const Type_handler *b) + const override + { return find_in_array(a, b, true); } + const Type_handler *aggregate_for_num_op(const Type_handler *a, + const Type_handler *b) + const override + { return NULL; } + + static Type_collection_uuid *singleton() + { + static Type_collection_uuid tc; + return &tc; + } +}; #include "sql_type_fixedbin.h" -typedef FixedBinTypeBundle UUIDBundle; +typedef Type_handler_fbt, Type_collection_uuid> Type_handler_uuid_old; +typedef Type_handler_fbt, Type_collection_uuid> Type_handler_uuid_new; #endif // SQL_TYPE_UUID_INCLUDED diff --git a/scripts/fill_help_tables.sql b/scripts/fill_help_tables.sql index 1ce2d583b2b..876662dae77 100644 --- a/scripts/fill_help_tables.sql +++ b/scripts/fill_help_tables.sql @@ -84,8 +84,8 @@ insert into help_category (help_category_id,name,parent_category_id,url) values 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','Help Contents generated from the MariaDB Knowledge Base on 10 February 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 11.0 from the MariaDB Knowledge Base on 10 February 2023.','',''); +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 25 July 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 11.0 from the MariaDB Knowledge Base on 25 July 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/'); @@ -162,8 +162,8 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, 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 (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 mariadb-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 mariadbd option, but it requires a server\nrestart.\n* A plugin can be installed with the mariadb-plugin utility, while the server\nis completely 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 mariadbd 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 mariadbd 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$ mariadbd --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 mariadbd 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$ mariadbd --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 mariadb-plugin\n---------------------------------------\n\nA plugin can be installed with the mariadb-plugin utility if the server is\ncompletely offline.\n\nThe syntax is:\n\nmariadb-plugin [options] ENABLE|DISABLE\n\nFor example, to install the server_audit audit plugin, you could execute the\nfollowing:\n\nmariadb-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 mariadbd\nor it can be specified in a relevant server option group in an option file.\nFor example:\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 mariadbd or it can be specified in\na relevant 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 mariadb-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+---------------------------------------+------------------------------------+','','https://mariadb.com/kb/en/plugin-overview/'); +update help_topic set description = CONCAT(description, '\n| FORCE | Enables the plugin. If the plugin |\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 mariadb-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 mariadb-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/'); @@ -178,26 +178,26 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, 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 (94,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. Note that\nunlike the global read_only mode, READ_ONLY ADMIN (and SUPER before MariaDB\n10.11.0) privilege doesn\'t allow writes and DDL statements on temporary tables\nare not allowed either.\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 (95,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 (96,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 (97,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 (note that the variable\nhas been renamed transaction_isolation from MariaDB 11.1.1, to match the\noption, and the old name deprecated).\n\nSELECT @@GLOBAL.tx_isolation, @@tx_isolation;\n\nFrom MariaDB 11.1.1:\n\nSELECT @@GLOBAL.transaction_isolation, @@transaction_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. Note that\nunlike the global read_only mode, READ_ONLY ADMIN (and SUPER before MariaDB\n10.11.0) privilege doesn\'t allow writes and DDL statements on temporary tables\nare not allowed either.\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 (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:\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 (103,8,'WAIT and NOWAIT','Extended syntax so that it is possible to set innodb_lock_wait_timeout and\nlock_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; +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 mariadb-admin 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. On Linux, the loopback interface (127.0.0.1) will not\nmatch \'localhost\' as it is not considered a local connection: this means that\nonly connections via UNIX-domain sockets will match \'localhost\'.\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 mariadb-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.\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 |\n+----------------------------------+-----------------------------------------+') WHERE help_topic_id = 108; -update help_topic set description = CONCAT(description, '\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+--------------------------------------+--------------------------------------+\n| Limit Type | Decription |') WHERE help_topic_id = 108; -update help_topic set description = CONCAT(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) |\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 (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\nGlobal privileges do not take effect immediately and are only applied to\nconnections created after the GRANT statement was executed.\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 mariadb-admin processlist. If you have the PROCESS privilege, you can see\nall threads. 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 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','','https://mariadb.com/kb/en/grant/'); +update help_topic set description = CONCAT(description, '\n* sync_relay_log_info.\n\nAdded in MariaDB 10.5.2.\n\nSET USER\n--------\n\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 mariadb-admin 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 mariadb-admin debug command. Also, this permission allows\nthe user 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 (MDEV-21743). The\nprivileges are:\n\n* SET USER\n* FEDERATED ADMIN\n* CONNECTION ADMIN\n* REPLICATION SLAVE ADMIN\n* BINLOG ADMIN\n* BINLOG REPLAY\n* REPLICA MONITOR\n* BINLOG MONITOR\n* REPLICATION MASTER ADMIN\n* READ_ONLY ADMIN\n\nHowever, the smaller privileges are still a part of the SUPER grant in MariaDB\n10.5.2. From MariaDB 11.0.1 onwards, these grants are no longer a part of\nSUPER and need to be granted separately (MDEV-29668).\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 (MDEV-29596).\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 mariadb-upgrade |\n| | will 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 |\n| | TRIGGER, DROP TRIGGER, and SHOW CREATE |\n| | TRIGGER statements. |\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 |') WHERE help_topic_id = 108; +update help_topic set description = CONCAT(description, '\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 |\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 mariadb-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') WHERE help_topic_id = 108; +update help_topic set description = CONCAT(description, '\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+--------------------------------------+--------------------------------------+\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 mariadb-admin 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/'); @@ -207,8 +207,8 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, 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 (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 mariadb-install-db is created\nwith the 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\nmariadb-install-db to use unix_socket authentication by default, then there\nare a few ways to revert to the previous mysql_native_password authentication\nmethod for this user account.\n\nConfiguring mariadb-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 mariadb-install-db with a\nspecial option. If mariadb-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\nmariadb-install-db: User Accounts Created by Default for more information.\n\nFor example, the option can be set on the command-line while running\nmariadb-install-db:\n\nmariadb-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\nmariadb-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 mariadb-install-db is executed,\nthen mariadb-install-db will read this option from the option file, and it\nwill automatically 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 mariadb 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/'); @@ -216,8 +216,8 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, 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 (127,12,'AES_DECRYPT','Syntax\n------\n\nAES_DECRYPT(crypt_str,key_str)\n\nFrom MariaDB 11.2.0\n\nAES_ENCRYPT(crypt_str, key_str, [, iv [, mode]])\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\nMariaDB starting with 11.2\n--------------------------\nFrom MariaDB 11.2, the function supports an initialization vector, and control\nof the block encryption mode. The default mode is specified by the\nblock_encryption_mode system variable, which can be changed when calling the\nfunction with a mode. mode is aes-{128,192,256}-{ecb,cbc,ctr} for example:\n\"AES-128-cbc\".\n\nFor modes that require it, the initialization_vector iv should be 16 bytes (it\ncan be longer, but the extra bytes are ignored). A shorter iv, where one is\nrequired, results in the function returning NULL. Calling RANDOM_BYTES(16)\nwill generate a random series of bytes that can be used for the iv.\n\nExamples\n--------\n\nFrom MariaDB 11.2.0:\n\nSELECT HEX(AES_ENCRYPT(\'foo\', \'bar\', \'0123456789abcdef\', \'aes-128-ctr\')) AS x; \n+--------+\n| x |\n+--------+\n| C57C4B |\n+--------+\n\nSELECT AES_DECRYPT(x\'C57C4B\', \'bar\', \'0123456789abcdef\', \'aes-128-ctr\'); \n+------------------------------------------------------------------+\n| AES_DECRYPT(x\'C57C4B\', \'bar\', \'0123456789abcdef\', \'aes-128-ctr\') |\n+------------------------------------------------------------------+\n| foo |\n+------------------------------------------------------------------+\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\nFrom MariaDB 11.2.0\n\nAES_ENCRYPT(str, key, [, iv [, mode]])\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 (from MariaDB 11.2.0,\nthis is the default, and can be changed). 128 bits is much faster and is\nsecure 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\nMariaDB starting with 11.2\n--------------------------\nFrom MariaDB 11.2, the function supports an initialization vector, and control\nof the block encryption mode. The default mode is specified by the\nblock_encryption_mode system variable, which can be changed when calling the\nfunction with a mode. mode is aes-{128,192,256}-{ecb,cbc,ctr} for example:\n\"AES-128-cbc\".\n\nAES_ENCRYPT(str, key) can no longer be used in persistent virtual columns (and\nthe like).\n\nExamples\n--------\n\nINSERT INTO t VALUES (AES_ENCRYPT(\'text\',SHA2(\'password\',512)));\n\nFrom MariaDB 11.2.0:\n\nSELECT HEX(AES_ENCRYPT(\'foo\', \'bar\', \'0123456789abcdef\', \'aes-256-cbc\')) AS x;\n+----------------------------------+\n| x |\n+----------------------------------+\n| 42A3EB91E6DFC40A900D278F99E0726E |\n+----------------------------------+\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/'); @@ -226,7 +226,7 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, 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,'RANDOM_BYTES','MariaDB starting with 10.10.0\n-----------------------------\nThe RANDOM_BYTES function generates a binary string of random bytes. It was\nadded in MariaDB 10.10.0.\n\nSyntax\n------\n\nRANDOM_BYTES(length)\n\nDescription\n-----------\n\nGiven a length from 1 to 1024, generates a binary string of length consisting\nof random bytes generated by the SSL library\'s random number generator.\n\nSee the RAND_bytes() function documentation of your SSL library for\ninformation on the random number generator. In the case of OpenSSL, a\ncryptographically secure pseudo random generator (CSPRNG) is used.\n\nStatements containing the RANDOM_BYTES function are unsafe for replication.\n\nAn error occurs if length is outside the range 1 to 1024.\n\nURL: https://mariadb.com/kb/en/random_bytes/','','https://mariadb.com/kb/en/random_bytes/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (137,12,'RANDOM_BYTES','MariaDB starting with 10.10.0\n-----------------------------\nThe RANDOM_BYTES function generates a binary string of random bytes. It was\nadded in MariaDB 10.10.0.\n\nSyntax\n------\n\nRANDOM_BYTES(length)\n\nDescription\n-----------\n\nGiven a length from 1 to 1024, generates a binary string of length consisting\nof random bytes generated by the SSL library\'s random number generator.\n\nSee the RAND_bytes() function documentation of your SSL library for\ninformation on the random number generator. In the case of OpenSSL, a\ncryptographically secure pseudo random generator (CSPRNG) is used.\n\nStatements containing the RANDOM_BYTES function are unsafe for statement-based\nreplication.\n\nAn error occurs if length is outside the range 1 to 1024.\n\nURL: https://mariadb.com/kb/en/random_bytes/','','https://mariadb.com/kb/en/random_bytes/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (138,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 (139,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 (140,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/'); @@ -238,7 +238,7 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (146,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 (147,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 (148,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 (149,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,'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 mariadb-admin 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. timeout\nsupports microseconds.\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 (150,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 (151,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 (152,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/'); @@ -281,7 +281,7 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (189,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 (190,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 (191,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 (192,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,'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 mariadb 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 (193,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 (194,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 (195,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/'); @@ -289,20 +289,20 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (197,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 (198,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 (199,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 (200,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,'DATABASE','Syntax\n------\n\nDATABASE()\nSCHEMA()\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 mariadb 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 (201,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 (202,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 (203,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 (204,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 (205,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,'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\nl_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\nl_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\nl_1f2f\nFROM t1;\n\n+------+------+------+--------+--------+--------+--------+--------+--------+\n| i | f_1f | l_1f | f_1p1f | l_1p1f | f_2p1p | l_2p1p | f_1f2f | l_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 (206,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 (207,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 (208,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,'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 mariadb 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 (209,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 (210,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 (211,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 (212,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 (213,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,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 |\n| | (libmariadbd). |\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\nOne can fool these applications by setting the version string from the command\nline 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 (214,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 (215,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 (216,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/'); @@ -335,14 +335,14 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (243,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 (244,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 (245,21,'ANALYZE TABLE','Syntax\n------\n\nANALYZE [NO_WRITE_TO_BINLOG | LOCAL] TABLE tbl_name [,tbl_name ...]\n [PERSISTENT FOR\n { ALL\n | COLUMNS ([col_name [,col_name ...]]) INDEXES ([index_name [,index_name\n...]])\n }\n ]\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\nExamples\n--------\n\n-- update all engine-independent statistics for all columns and indexes\nANALYZE TABLE tbl PERSISTENT FOR ALL;\n\n-- update specific columns and indexes:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS (col1,col2,...) INDEXES\n(idx1,idx2,...);\n\n-- empty lists are allowed:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS (col1,col2,...) INDEXES ();\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS () INDEXES (idx1,idx2,...);\n\n-- the following will only update mysql.table_stats fields:\nANALYZE TABLE tbl PERSISTENT FOR COLUMNS () INDEXES ();\n\n-- when use_stat_tables is set to \'COMPLEMENTARY\' or \'PREFERABLY\', \n-- a simple ANALYZE TABLE collects engine-independent statistics for all\ncolumns and indexes.\nSET SESSION use_stat_tables=\'COMPLEMENTARY\';\nANALYZE TABLE tbl;\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 (246,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 InnoDB, Aria, |\n| NDE | and MyISAM, verify for each row that all its keys exists, and for |\n| | those index keys, they point back to the primary clustered key. |\n| | This may take a long time on large tables. This option was |\n| | previously ignored by InnoDB before MariaDB 10.6.11, MariaDB |\n| | 10.7.7, MariaDB 10.8.6 and MariaDB 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 (247,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 (246,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 mariadb-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 InnoDB, Aria, |\n| NDE | and MyISAM, verify for each row that all its keys exists, and for |\n| | those index keys, they point back to the primary clustered key. |\n| | This may take a long time on large tables. This option was |\n| | previously ignored by InnoDB before MariaDB 10.6.11, MariaDB |\n| | 10.7.7, MariaDB 10.8.6 and MariaDB 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 (247,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 mariadb-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 (248,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 (249,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,'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\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\nOPTIMIZE TABLE statements are not logged to the binary log if read_only is\nset. 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 (250,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 (251,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,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 mariadb-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 (252,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 (253,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,'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\nmariadb-upgrade command 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 (254,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 (255,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 (256,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/'); @@ -360,15 +360,15 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (268,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 (269,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 (270,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 (271,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 (272,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 (271,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\nBLOB and TEXT columns can both be assigned a DEFAULT value.\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\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 (272,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\nBLOB 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 (273,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 (274,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 (275,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 (276,23,'INET4','MariaDB starting with 10.10.0\n-----------------------------\nThe INET4 data type was added in MariaDB 10.10.0\n\nINET4 is a data type to store IPv4 addresses, as 4-byte binary strings.\n\nURL: https://mariadb.com/kb/en/inet4/','','https://mariadb.com/kb/en/inet4/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (276,23,'INET4','MariaDB starting with 10.10.0\n-----------------------------\nThe INET4 data type was added in MariaDB 10.10.0\n\nSyntax\n------\n\nINET4\n\nDescription\n-----------\n\nINET4 is a data type to store IPv4 addresses, as 4-byte binary strings.\n\nExamples\n--------\n\nCREATE OR REPLACE TABLE t1 (a INET4);\n\nINSERT INTO t1 VALUES(\'0.0.0.0\'), (\'255.10.0.0\'), (\'255.255.255.255\');\n\nINSERT INTO t1 VALUES (0xa0000001);\nINSERT INTO t1 VALUES (0xf0000000);\nINSERT INTO t1 VALUES (0xff000001);\n\nSELECT HEX(a), a FROM t1 ORDER BY a;\n+----------+-----------------+\n| HEX(a) | a |\n+----------+-----------------+\n| 00000000 | 0.0.0.0 |\n| A0000001 | 160.0.0.1 |\n| F0000000 | 240.0.0.0 |\n| FF000001 | 255.0.0.1 |\n| FF0A0000 | 255.10.0.0 |\n| FFFFFFFF | 255.255.255.255 |\n+----------+-----------------+\n\nURL: https://mariadb.com/kb/en/inet4/','','https://mariadb.com/kb/en/inet4/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (277,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 = 277; -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (278,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 (278,23,'JSON Data Type','The JSON alias was added to make it possible to use JSON columns in statement\nbased replication from MySQL to MariaDB and to make it possible for MariaDB to\nread 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 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 (279,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 (280,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 (281,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/'); @@ -382,14 +382,14 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (289,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 (290,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 (291,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 (292,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 (293,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 (294,23,'TIMESTAMP','Syntax\n------\n\nTIMESTAMP [()]\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 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 mariadb-dump. 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 (293,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\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 (294,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 (298,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 (299,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 (299,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 mariadb client for\nmore on 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 (300,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 (301,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 (302,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/'); @@ -399,8 +399,8 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (306,24,'ITERATE','Syntax\n------\n\nITERATE label\n\nITERATE can appear only within LOOP, REPEAT, and WHILE statements. ITERATE\nmeans \"do the loop again\", and uses the statement\'s label to determine which\nstatements to repeat. The 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 the label is\nassociated to a construct which is not a loop, the following error will be\nproduced:\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 IF p1 < 10 THEN ITERATE label1; END IF;\n LEAVE label1;\n END LOOP label1;\n SET @x = p1;\nEND\n\nURL: https://mariadb.com/kb/en/iterate/','','https://mariadb.com/kb/en/iterate/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (307,24,'Labels','Syntax\n------\n\nlabel: \n[label]\n\nLabels are MariaDB identifiers which can be used to identify a BEGIN ... END\nconstruct or a loop. They have a maximum length of 16 characters and can be\nquoted with backticks (i.e.., `).\n\nLabels have a start part and an end part. The start part must precede the\nportion of code it refers to, must be followed by a colon (:) and can be on\nthe same or different line. The end part is optional and adds nothing, but can\nmake the code more readable. If used, the end part must precede the\nconstruct\'s delimiter (;). Constructs identified by a label can be nested.\nEach construct can be identified by only one label.\n\nLabels need not be unique in the stored program they belong to. However, a\nlabel for an inner loop cannot be identical to a label for an outer loop. In\nthis case, the following error would be produced:\n\nERROR 1309 (42000): Redefining label \n\nLEAVE and ITERATE statements can be used to exit or repeat a portion of code\nidentified by a label. They must be in the same Stored Routine, Trigger or\nEvent which contains the target label.\n\nBelow is an example using a simple label that is used to exit a LOOP:\n\nCREATE PROCEDURE `test_sp`()\nBEGIN\n `my_label`:\n LOOP\n SELECT \'looping\';\n LEAVE `my_label`;\n END LOOP;\n SELECT \'out of loop\';\nEND;\n\nThe following label is used to exit a procedure, and has an end part:\n\nCREATE PROCEDURE `test_sp`()\n`my_label`:\nBEGIN\n IF @var = 1 THEN\n LEAVE `my_label`;\n END IF;\n DO something();\nEND `my_label`;\n\nURL: https://mariadb.com/kb/en/labels/','','https://mariadb.com/kb/en/labels/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (308,24,'LEAVE','Syntax\n------\n\nLEAVE label\n\nThis statement is used to exit the flow control construct that has the given\nlabel. The label must be in the same stored program, not in a caller\nprocedure. LEAVE can be used within BEGIN ... END or loop constructs (LOOP,\nREPEAT, WHILE). In Stored Procedures, Triggers and Events, LEAVE can refer to\nthe outmost BEGIN ... END construct; in that case, the program exits the\nprocedure. In Stored Functions, RETURN can be used instead.\n\nNote that LEAVE cannot be used to exit a DECLARE HANDLER block.\n\nIf you try to LEAVE a non-existing label, or if you try to LEAVE a HANDLER\nblock, 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 condition is true:\n\nCREATE PROCEDURE proc(IN p TINYINT)\nCONTAINS SQL\n`whole_proc`:\nBEGIN\n SELECT 1;\n IF p < 1 THEN\n LEAVE `whole_proc`;\n END IF;\n SELECT 2;\nEND;\n\nCALL proc(0);\n+---+\n| 1 |\n+---+\n| 1 |\n+---+\n\nURL: https://mariadb.com/kb/en/leave/','','https://mariadb.com/kb/en/leave/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (309,24,'LOOP','Syntax\n------\n\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\nDescription\n-----------\n\nLOOP implements a simple loop construct, enabling repeated execution of the\nstatement list, which consists of one or more statements, each terminated by a\nsemicolon (i.e., ;) statement delimiter. The statements within the loop are\nrepeated until the loop is exited; usually this is accomplished with a LEAVE\nstatement.\n\nA LOOP statement can be labeled. end_label cannot be given unless begin_label\nalso is present. If both are present, they must be the same.\n\nSee Delimiters in the mysql client for more on delimiter usage in the client.\n\nURL: https://mariadb.com/kb/en/loop/','','https://mariadb.com/kb/en/loop/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (310,24,'REPEAT LOOP','Syntax\n------\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 until the\nsearch_condition is true. Thus, a REPEAT always enters the loop at least once.\nstatement_list consists of one or more statements, each terminated by a\nsemicolon (i.e., ;) statement delimiter.\n\nA REPEAT statement can be labeled. end_label cannot be given unless\nbegin_label also is present. If both are present, they must be the same.\n\nSee Delimiters in the mysql client for more on client delimiter usage.\n\nDELIMITER //\n\nCREATE PROCEDURE dorepeat(p1 INT)\n BEGIN\n SET @x = 0;\n REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;\n END\n//\n\nCALL dorepeat(1000)//\n\nSELECT @x//\n+------+\n| @x |\n+------+\n| 1001 |\n+------+\n\nURL: https://mariadb.com/kb/en/repeat-loop/','','https://mariadb.com/kb/en/repeat-loop/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (309,24,'LOOP','Syntax\n------\n\n[begin_label:] LOOP\n statement_list\nEND LOOP [end_label]\n\nDescription\n-----------\n\nLOOP implements a simple loop construct, enabling repeated execution of the\nstatement list, which consists of one or more statements, each terminated by a\nsemicolon (i.e., ;) statement delimiter. The statements within the loop are\nrepeated until the loop is exited; usually this is accomplished with a LEAVE\nstatement.\n\nA LOOP statement can be labeled. end_label cannot be given unless begin_label\nalso is present. If both are present, they must be the same.\n\nSee Delimiters in the mariadb client for more on delimiter usage in the client.\n\nURL: https://mariadb.com/kb/en/loop/','','https://mariadb.com/kb/en/loop/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (310,24,'REPEAT LOOP','Syntax\n------\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 until the\nsearch_condition is true. Thus, a REPEAT always enters the loop at least once.\nstatement_list consists of one or more statements, each terminated by a\nsemicolon (i.e., ;) statement delimiter.\n\nA REPEAT statement can be labeled. end_label cannot be given unless\nbegin_label also is present. If both are present, they must be the same.\n\nSee Delimiters in the mariadb client for more on client delimiter usage.\n\nDELIMITER //\n\nCREATE PROCEDURE dorepeat(p1 INT)\n BEGIN\n SET @x = 0;\n REPEAT SET @x = @x + 1; UNTIL @x > p1 END REPEAT;\n END\n//\n\nCALL dorepeat(1000)//\n\nSELECT @x//\n+------+\n| @x |\n+------+\n| 1001 |\n+------+\n\nURL: https://mariadb.com/kb/en/repeat-loop/','','https://mariadb.com/kb/en/repeat-loop/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (311,24,'RESIGNAL','Syntax\n------\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-----------\n\nThe syntax of RESIGNAL and its semantics are very similar to SIGNAL. This\nstatement can only be used within an error HANDLER. It produces an error, like\nSIGNAL. RESIGNAL clauses are the same as SIGNAL, except that they all are\noptional, even SQLSTATE. All the properties which are not specified in\nRESIGNAL, will be identical to the properties of the error that was received\nby the error HANDLER. For a description of the clauses, see diagnostics area.\n\nNote that RESIGNAL does not empty the diagnostics area: it just appends\nanother error condition.\n\nRESIGNAL, without any clauses, produces an error which is identical to the\nerror that was received by HANDLER.\n\nIf used out of a HANDLER construct, RESIGNAL produces the following error:\n\nERROR 1645 (0K000): RESIGNAL when handler not active\n\nIn MariaDB 5.5, if a HANDLER contained a CALL to another procedure, that\nprocedure could use RESIGNAL. Since MariaDB 10.0, trying to do this raises the\nabove error.\n\nFor a list of SQLSTATE values and MariaDB error codes, see MariaDB Error Codes.\n\nThe following procedure tries to query two tables which don\'t exist, producing\na 1146 error in both cases. Those errors will trigger the HANDLER. The first\ntime the error will be ignored and the client will not receive it, but the\nsecond time, the error is re-signaled, so the client will receive 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 END IF;\n END;\n SET @hide_errors = TRUE;\n SELECT \'Next error will be ignored\' AS msg;\n SELECT `c` FROM `temptab_one`;\n SELECT \'Next error won\'\'t be ignored\' AS msg;\n SET @hide_errors = FALSE;\n SELECT `c` FROM `temptab_two`;\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 exist\n\nThe following procedure re-signals an error, modifying only the error message\nto 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 END;\n SELECT `c` FROM `temptab`;\nEND;\n\nCALL test_error( );\nERROR 1146 (42S02): `temptab` does not exist\n\nAs explained above, this works on MariaDB 5.5, but produces a 1645 error since\n10.0.\n\nCREATE PROCEDURE handle_error()\nBEGIN\n RESIGNAL;\nEND;\nCREATE PROCEDURE p()\nBEGIN\n DECLARE EXIT HANDLER FOR SQLEXCEPTION CALL p();\n SIGNAL SQLSTATE \'45000\';\nEND;\n\nURL: https://mariadb.com/kb/en/resignal/','','https://mariadb.com/kb/en/resignal/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (312,24,'RETURN','Syntax\n------\n\nRETURN expr\n\nThe RETURN statement terminates execution of a stored function and returns the\nvalue expr to the function caller. There must be at least one RETURN statement\nin a stored function. If the function has multiple exit points, all exit\npoints must have a RETURN.\n\nThis statement is not used in stored procedures, triggers, or events. LEAVE\ncan be used instead.\n\nThe following example shows that RETURN can return the result of a scalar\nsubquery:\n\nCREATE FUNCTION users_count() RETURNS BOOL\n READS SQL DATA\nBEGIN\n RETURN (SELECT COUNT(DISTINCT User) FROM mysql.user);\nEND;\n\nURL: https://mariadb.com/kb/en/return/','','https://mariadb.com/kb/en/return/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (313,24,'SELECT INTO','Syntax\n------\n\nSELECT col_name [, col_name] ...\n INTO var_name [, var_name] ...\n table_expr\n\nDescription\n-----------\n\nSELECT ... INTO enables selected columns to be stored directly into variables.\nNo resultset is produced. The query should return a single row. If the query\nreturns no rows, a warning with error code 1329 occurs (No data), and the\nvariable values remain unchanged. If the query returns multiple rows, error\n1172 occurs (Result consisted of more than one row). If it is possible that\nthe statement may retrieve multiple rows, you can use LIMIT 1 to limit the\nresult set to a single row.\n\nThe INTO clause can also be specified at the end of the statement.\n\nIn the context of such statements that occur as part of events executed by the\nEvent Scheduler, diagnostics messages (not only errors, but also warnings) are\nwritten to the error log, and, on Windows, to the application event log.\n\nThis statement can be used with both local variables and user-defined\nvariables.\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 even if SQL_CACHE is\nspecified.\n\nExamples\n--------\n\nSELECT id, data INTO @x,@y \nFROM test.t1 LIMIT 1;\nSELECT * from t1 where t1.a=@x and t1.b=@y\n\nIf you want to use this construct with UNION you have to use the syntax:\n\nSELECT * INTO @x FROM (SELECT t1.a FROM t1 UNION SELECT t2.a FROM t2);\n\nURL: https://mariadb.com/kb/en/selectinto/','','https://mariadb.com/kb/en/selectinto/'); @@ -429,19 +429,19 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (336,25,'ST_UNION','Syntax\n------\n\nST_UNION(g1,g2)\n\nDescription\n-----------\n\nReturns a geometry that is the union of the geometry g1 and geometry g2.\n\nExamples\n--------\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\nURL: https://mariadb.com/kb/en/st_union/','','https://mariadb.com/kb/en/st_union/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (337,26,'SHOW GRANTS','Syntax\n------\n\nSHOW GRANTS [FOR user|role]\n\nDescription\n-----------\n\nThe SHOW GRANTS statement lists privileges granted to a particular user or\nrole.\n\nUsers\n-----\n\nThe statement lists the GRANT statement or statements that must be issued to\nduplicate the privileges that are granted to a MariaDB user account. The\naccount is named using the same format as for the GRANT statement; for\nexample, \'jeffrey\'@\'localhost\'. If you specify only the user name part of the\naccount name, a host name part of \'%\' is used. For additional information\nabout specifying account names, see GRANT.\n\nSHOW GRANTS FOR \'root\'@\'localhost\';\n+---------------------------------------------------------------------+\n| Grants for root@localhost |\n+---------------------------------------------------------------------+\n| GRANT ALL PRIVILEGES ON *.* TO \'root\'@\'localhost\' WITH GRANT OPTION |\n+---------------------------------------------------------------------+\n\nTo list the privileges granted to the account that you are using to connect to\nthe server, you can use any of the following statements:\n\nSHOW GRANTS;\nSHOW GRANTS FOR CURRENT_USER;\nSHOW GRANTS FOR CURRENT_USER();\n\nIf SHOW GRANTS FOR CURRENT_USER (or any of the equivalent syntaxes) is used in\nDEFINER context (such as within a stored procedure that is defined with SQL\nSECURITY DEFINER), the grants displayed are those of the definer and not the\ninvoker.\n\nNote that the DELETE HISTORY privilege, introduced in MariaDB 10.3.4, was\ndisplayed as DELETE VERSIONING ROWS when running SHOW GRANTS until MariaDB\n10.3.15 (MDEV-17655).\n\nRoles\n-----\n\nSHOW GRANTS can also be used to view the privileges granted to a role.\n\nExample\n-------\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\nFOR PUBLIC\n----------\n\nMariaDB starting with 10.11\n---------------------------\nGRANT ... TO PUBLIC was introduced in MariaDB 10.11 to grant privileges to all\nusers. SHOW GRANTS FOR PUBLIC shows all these grants.\n\nSHOW GRANTS FOR public;\n+------------------------------------------------+\n| Grants for PUBLIC |\n+------------------------------------------------+\n| GRANT ALL PRIVILEGES ON `dev_db`.* TO `PUBLIC` |\n+------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/show-grants/','','https://mariadb.com/kb/en/show-grants/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (338,26,'SHOW CREATE USER','Syntax\n------\n\nSHOW CREATE USER user_name\n\nDescription\n-----------\n\nShows the CREATE USER statement that created the given user. The statement\nrequires the SELECT privilege for the mysql database, except for the current\nuser.\n\nExamples\n--------\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 ***************************\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 120 DAY;\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\nURL: https://mariadb.com/kb/en/show-create-user/','','https://mariadb.com/kb/en/show-create-user/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (339,26,'SHOW COLUMNS','Syntax\n------\n\nSHOW [FULL] {COLUMNS | FIELDS} FROM tbl_name [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW COLUMNS displays information about the columns in a given table. It also\nworks for views. The LIKE clause, if present on its own, indicates which\ncolumn names to match. The WHERE and LIKE clauses can be given to select rows\nusing more general conditions, as discussed in Extended SHOW.\n\nIf the data types differ from what you expect them to be based on a CREATE\nTABLE statement, note that MariaDB sometimes changes data types when you\ncreate or alter a table. The conditions under which this occurs are described\nin the Silent Column Changes article.\n\nThe FULL keyword causes the output to include the column collation and\ncomments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM db_name\nsyntax. In other words, these two statements are equivalent:\n\nSHOW COLUMNS FROM mytable FROM mydb;\nSHOW COLUMNS FROM mydb.mytable;\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for non-binary string columns, or NULL for\nother columns. This value is displayed only if you use the FULL keyword.\n\nThe Null field contains YES if NULL values can be stored in the column, NO if\nnot.\n\nThe Key field indicates whether the column is indexed:\n\n* If Key is empty, the column either is not indexed or is indexed only as a\n secondary column in a multiple-column, non-unique index.\n* If Key is PRI, the column is a PRIMARY KEY or\n is one of the columns in a multiple-column PRIMARY KEY.\n* If Key is UNI, the column is the first column of a unique-valued\n index that cannot contain NULL values.\n* If Key is MUL, multiple occurrences of a given value are allowed\n within the column. The column is the first column of a non-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 of a table, Key\ndisplays the one with the highest priority, in the order PRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values and\nthere is no PRIMARY KEY in the table. A UNIQUE index may display as MUL if\nseveral columns form a composite UNIQUE index; although the combination of the\ncolumns is unique, each column can still hold multiple occurrences of a given\nvalue.\n\nThe Default field indicates the default value that is assigned to the column.\n\nThe Extra field contains any additional information that is available about a\ngiven column.\n\n+------------------------+---------------------------------------------------+\n| Value | Description |\n+------------------------+---------------------------------------------------+\n| AUTO_INCREMENT | The column was created with the AUTO_INCREMENT |\n| | keyword. |\n+------------------------+---------------------------------------------------+\n| PERSISTENT | The column was created with the PERSISTENT |\n| | keyword. (New in 5.3) |\n+------------------------+---------------------------------------------------+\n| VIRTUAL | The column was created with the VIRTUAL keyword. |\n| | (New in 5.3) |\n+------------------------+---------------------------------------------------+\n| on update | The column is a TIMESTAMP column that is |\n| CURRENT_TIMESTAMP | automatically updated on INSERT and UPDATE. |\n+------------------------+---------------------------------------------------+\n\nPrivileges indicates the privileges you have for the column. This value is\ndisplayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed only if\nyou use the FULL keyword.\n\nSHOW FIELDS is a synonym for SHOW COLUMNS. Also DESCRIBE and EXPLAIN can be\nused as shortcuts.\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 COLUMNS. The\ninformation_schema.COLUMNS table provides similar, but more complete,\ninformation.\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements also\nprovide information about tables.\n\nExamples\n--------\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\nURL: https://mariadb.com/kb/en/show-columns/','','https://mariadb.com/kb/en/show-columns/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (339,26,'SHOW COLUMNS','Syntax\n------\n\nSHOW [FULL] {COLUMNS | FIELDS} FROM tbl_name [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW COLUMNS displays information about the columns in a given table. It also\nworks for views. The LIKE clause, if present on its own, indicates which\ncolumn names to match. The WHERE and LIKE clauses can be given to select rows\nusing more general conditions, as discussed in Extended SHOW.\n\nIf the data types differ from what you expect them to be based on a CREATE\nTABLE statement, note that MariaDB sometimes changes data types when you\ncreate or alter a table. The conditions under which this occurs are described\nin the Silent Column Changes article.\n\nThe FULL keyword causes the output to include the column collation and\ncomments, as well as the privileges you have for each column.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM db_name\nsyntax. In other words, these two statements are equivalent:\n\nSHOW COLUMNS FROM mytable FROM mydb;\nSHOW COLUMNS FROM mydb.mytable;\n\nSHOW COLUMNS displays the following values for each table column:\n\nField indicates the column name.\n\nType indicates the column data type.\n\nCollation indicates the collation for non-binary string columns, or NULL for\nother columns. This value is displayed only if you use the FULL keyword.\n\nThe Null field contains YES if NULL values can be stored in the column, NO if\nnot.\n\nThe Key field indicates whether the column is indexed:\n\n* If Key is empty, the column either is not indexed or is indexed only as a\n secondary column in a multiple-column, non-unique index.\n* If Key is PRI, the column is a PRIMARY KEY or\n is one of the columns in a multiple-column PRIMARY KEY.\n* If Key is UNI, the column is the first column of a unique-valued\n index that cannot contain NULL values.\n* If Key is MUL, multiple occurrences of a given value are allowed\n within the column. The column is the first column of a non-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 of a table, Key\ndisplays the one with the highest priority, in the order PRI, UNI, MUL.\n\nA UNIQUE index may be displayed as PRI if it cannot contain NULL values and\nthere is no PRIMARY KEY in the table. A UNIQUE index may display as MUL if\nseveral columns form a composite UNIQUE index; although the combination of the\ncolumns is unique, each column can still hold multiple occurrences of a given\nvalue.\n\nThe Default field indicates the default value that is assigned to the column.\n\nThe Extra field contains any additional information that is available about a\ngiven column.\n\n+------------------------+---------------------------------------------------+\n| Value | Description |\n+------------------------+---------------------------------------------------+\n| AUTO_INCREMENT | The column was created with the AUTO_INCREMENT |\n| | keyword. |\n+------------------------+---------------------------------------------------+\n| PERSISTENT | The column was created with the PERSISTENT |\n| | keyword. (New in 5.3) |\n+------------------------+---------------------------------------------------+\n| VIRTUAL | The column was created with the VIRTUAL keyword. |\n| | (New in 5.3) |\n+------------------------+---------------------------------------------------+\n| on update | The column is a TIMESTAMP column that is |\n| CURRENT_TIMESTAMP | automatically updated on INSERT and UPDATE. |\n+------------------------+---------------------------------------------------+\n\nPrivileges indicates the privileges you have for the column. This value is\ndisplayed only if you use the FULL keyword.\n\nComment indicates any comment the column has. This value is displayed only if\nyou use the FULL keyword.\n\nSHOW FIELDS is a synonym for SHOW COLUMNS. Also DESCRIBE and EXPLAIN can be\nused as shortcuts.\n\nYou can also list a table\'s columns with:\n\nmariadb-show db_name tbl_name\n\nSee the mariadb-show command for more details.\n\nThe DESCRIBE statement provides information similar to SHOW COLUMNS. The\ninformation_schema.COLUMNS table provides similar, but more complete,\ninformation.\n\nThe SHOW CREATE TABLE, SHOW TABLE STATUS, and SHOW INDEX statements also\nprovide information about tables.\n\nExamples\n--------\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\nURL: https://mariadb.com/kb/en/show-columns/','','https://mariadb.com/kb/en/show-columns/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (340,26,'SHOW CREATE TABLE','Syntax\n------\n\nSHOW CREATE TABLE tbl_name\n\nDescription\n-----------\n\nShows the CREATE TABLE statement that created the given table. The statement\nrequires the SELECT privilege for the table. This statement also works with\nviews and SEQUENCE.\n\nSHOW CREATE TABLE quotes table and column names according to the value of the\nsql_quote_show_create server system variable.\n\nCertain SQL_MODE values can result in parts of the original CREATE statement\nnot being included in the output. MariaDB-specific table options, column\noptions, and index options are not included in the output of this statement if\nthe NO_TABLE_OPTIONS, NO_FIELD_OPTIONS and NO_KEY_OPTIONS SQL_MODE flags are\nused. All MariaDB-specific table attributes are also not shown when a\nnon-MariaDB/MySQL emulation mode is used, which includes ANSI, DB2,\nPOSTGRESQL, MSSQL, MAXDB or ORACLE.\n\nInvalid table options, column options and index options are normally commented\nout (note, that it is possible to create a table with invalid options, by\naltering a table of a different engine, where these options were valid). To\nhave them uncommented, enable the IGNORE_BAD_TABLE_OPTIONS SQL_MODE. Remember\nthat replaying a CREATE TABLE statement with uncommented invalid options will\nfail with an error, unless the IGNORE_BAD_TABLE_OPTIONS SQL_MODE is in effect.\n\nNote that SHOW CREATE TABLE is not meant to provide metadata about a table. It\nprovides information about how the table was declared, but the real table\nstructure could differ a bit. For example, if an index has been declared as\nHASH, the CREATE TABLE statement returned by SHOW CREATE TABLE will declare\nthat index as HASH; however, it is possible that the index is in fact a BTREE,\nbecause the storage engine does not support HASH.\n\nMariaDB starting with 10.2.1\n----------------------------\nMariaDB 10.2.1 permits TEXT and BLOB data types to be assigned a DEFAULT\nvalue. As a result, from MariaDB 10.2.1, SHOW CREATE TABLE will append a\nDEFAULT NULL to nullable TEXT or BLOB fields if no specific default is\nprovided.\n\nMariaDB starting with 10.2.2\n----------------------------\nFrom MariaDB 10.2.2, numbers are no longer quoted in the DEFAULT clause in\nSHOW CREATE statement. Previously, MariaDB quoted numbers.\n\nIndex Order\n-----------\n\nIndexes are sorted and displayed in the following order, which may differ from\nthe order of the CREATE TABLE statement.\n\n* PRIMARY KEY\n* UNIQUE keys where all column are NOT NULL\n* UNIQUE keys that don\'t contain partial segments\n* Other UNIQUE keys\n* LONG UNIQUE keys\n* Normal keys\n* Fulltext keys\n\nSee sql/sql_table.cc for details.\n\nExamples\n--------\n\nSHOW CREATE TABLE t\\G\n*************************** 1. row ***************************\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 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 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 Table: td\nCreate Table: CREATE TABLE `td` (\n `link` tinyint(4) DEFAULT \'1\'\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n\nSQL_MODE impacting the output:\n\nSELECT @@sql_mode;\n+------------------------------------------------------------------------------\n------------+\n| @@sql_mode \n |\n+------------------------------------------------------------------------------\n------------+\n|\nSTRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SU\nSTITUTION |\n+------------------------------------------------------------------------------\n------------+\n\nCREATE TABLE `t1` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `msg` varchar(100) DEFAULT NULL,\n PRIMARY KEY (`id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=latin1\n;\n\nSHOW CREATE TABLE t1\\G\n*************************** 1. row ***************************\n Table: t1\nCreate Table: CREATE TABLE `t1` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `msg` varchar(100) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1\n\nSET SQL_MODE=ORACLE;\n\nSHOW CREATE TABLE t1\\G\n*************************** 1. row ***************************\n Table: t1\nCreate Table: CREATE TABLE \"t1\" (\n \"id\" int(11) NOT NULL,\n \"msg\" varchar(100) DEFAULT NULL,\n PRIMARY KEY (\"id\")\n\nURL: https://mariadb.com/kb/en/show-create-table/','','https://mariadb.com/kb/en/show-create-table/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (341,26,'SHOW INDEX','Syntax\n------\n\nSHOW {INDEX | INDEXES | KEYS} \n FROM tbl_name [FROM db_name]\n [WHERE expr]\n\nDescription\n-----------\n\nSHOW INDEX returns table index information. The format resembles that of the\nSQLStatistics call in ODBC.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM db_name\nsyntax. These two statements are 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 mariadb-show/mysqlshow command:\n\nmysqlshow -k db_name tbl_name\n\nThe information_schema.STATISTICS table stores similar information.\n\nThe following fields are returned by SHOW INDEX.\n\n+------------------------+---------------------------------------------------+\n| Field | Description |\n+------------------------+---------------------------------------------------+\n| Table | Table name |\n+------------------------+---------------------------------------------------+\n| Non_unique | 1 if the index permits duplicate values, 0 if |\n| | values must be unique. |\n+------------------------+---------------------------------------------------+\n| Key_name | Index name. The primary key is always named |\n| | PRIMARY. |\n+------------------------+---------------------------------------------------+\n| Seq_in_index | The column\'s sequence in the index, beginning |\n| | with 1. |\n+------------------------+---------------------------------------------------+\n| Column_name | Column name. |\n+------------------------+---------------------------------------------------+\n| Collation | Either A, if the column is sorted in ascending |\n| | order in the index, or NULL if it\'s not sorted. |\n+------------------------+---------------------------------------------------+\n| Cardinality | Estimated number of unique values in the index. |\n| | The cardinality statistics are calculated at |\n| | various times, and can help the optimizer make |\n| | improved decisions. |\n+------------------------+---------------------------------------------------+\n| Sub_part | NULL if the entire column is included in the |\n| | index, or the number of included characters if |\n| | not. |\n+------------------------+---------------------------------------------------+\n| Packed | NULL if the index is not packed, otherwise how |\n| | the index is packed. |\n+------------------------+---------------------------------------------------+\n| Null | NULL if NULL values are permitted in the column, |\n| | an empty string if NULLs are not permitted. |\n+------------------------+---------------------------------------------------+\n| Index_type | The index type, which can be BTREE, FULLTEXT, |\n| | HASH or RTREE. See Storage Engine Index Types. |\n+------------------------+---------------------------------------------------+\n| Comment | Other information, such as whether the index is |\n| | disabled. |\n+------------------------+---------------------------------------------------+\n| Index_comment | Contents of the COMMENT attribute when the index |\n| | was created. |\n+------------------------+---------------------------------------------------+\n| Ignored | Whether or not an index will be ignored by the |\n| | optimizer. See Ignored Indexes. From MariaDB |\n| | 10.6.0. |\n+------------------------+---------------------------------------------------+\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nExamples\n--------\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`, `position`,\n`home_address`, `home_phone`, `employee_code`)\n VALUES\n (\'Mustapha\', \'Mond\', \'Chief Executive Officer\', \'692 Promiscuous Plaza\',\n\'326-555-3492\', \'MM1\'),\n (\'Henry\', \'Foster\', \'Store Manager\', \'314 Savage Circle\', \'326-555-3847\',\n\'HF1\'),\n (\'Bernard\', \'Marx\', \'Cashier\', \'1240 Ambient Avenue\', \'326-555-8456\', \'BM1\'),\n (\'Lenina\', \'Crowne\', \'Cashier\', \'281 Bumblepuppy Boulevard\', \'328-555-2349\',\n\'LC1\'),\n (\'Fanny\', \'Crowne\', \'Restocker\', \'1023 Bokanovsky Lane\', \'326-555-6329\',\n\'FC1\'),\n (\'Helmholtz\', \'Watson\', \'Janitor\', \'944 Soma Court\', \'329-555-2478\', \'HW1\');\n\nSHOW INDEXES FROM employees_example\\G\n*************************** 1. row ***************************\n Table: employees_example\n Non_unique: 0\n Key_name: PRIMARY\n Seq_in_index: 1\n Column_name: id\n Collation: A\n Cardinality: 6\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n*************************** 2. row ***************************\n Table: employees_example\n Non_unique: 0\n Key_name: employee_code\n Seq_in_index: 1\n Column_name: employee_code\n Collation: A\n Cardinality: 6\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n*************************** 3. row ***************************\n Table: employees_example\n Non_unique: 1\n Key_name: first_name\n Seq_in_index: 1\n Column_name: first_name\n Collation: A\n Cardinality: NULL\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n*************************** 4. row ***************************\n Table: employees_example\n Non_unique: 1\n Key_name: first_name\n Seq_in_index: 2\n Column_name: last_name\n Collation: A\n Cardinality: NULL\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n\nURL: https://mariadb.com/kb/en/show-index/','','https://mariadb.com/kb/en/show-index/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (341,26,'SHOW INDEX','Syntax\n------\n\nSHOW {INDEX | INDEXES | KEYS} \n FROM tbl_name [FROM db_name]\n [WHERE expr]\n\nDescription\n-----------\n\nSHOW INDEX returns table index information. The format resembles that of the\nSQLStatistics call in ODBC.\n\nYou can use db_name.tbl_name as an alternative to the tbl_name FROM db_name\nsyntax. These two statements are 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 mariadb-show command:\n\nmariadb-show -k db_name tbl_name\n\nThe information_schema.STATISTICS table stores similar information.\n\nThe following fields are returned by SHOW INDEX.\n\n+------------------------+---------------------------------------------------+\n| Field | Description |\n+------------------------+---------------------------------------------------+\n| Table | Table name |\n+------------------------+---------------------------------------------------+\n| Non_unique | 1 if the index permits duplicate values, 0 if |\n| | values must be unique. |\n+------------------------+---------------------------------------------------+\n| Key_name | Index name. The primary key is always named |\n| | PRIMARY. |\n+------------------------+---------------------------------------------------+\n| Seq_in_index | The column\'s sequence in the index, beginning |\n| | with 1. |\n+------------------------+---------------------------------------------------+\n| Column_name | Column name. |\n+------------------------+---------------------------------------------------+\n| Collation | Either A, if the column is sorted in ascending |\n| | order in the index, or NULL if it\'s not sorted. |\n+------------------------+---------------------------------------------------+\n| Cardinality | Estimated number of unique values in the index. |\n| | The cardinality statistics are calculated at |\n| | various times, and can help the optimizer make |\n| | improved decisions. |\n+------------------------+---------------------------------------------------+\n| Sub_part | NULL if the entire column is included in the |\n| | index, or the number of included characters if |\n| | not. |\n+------------------------+---------------------------------------------------+\n| Packed | NULL if the index is not packed, otherwise how |\n| | the index is packed. |\n+------------------------+---------------------------------------------------+\n| Null | NULL if NULL values are permitted in the column, |\n| | an empty string if NULLs are not permitted. |\n+------------------------+---------------------------------------------------+\n| Index_type | The index type, which can be BTREE, FULLTEXT, |\n| | HASH or RTREE. See Storage Engine Index Types. |\n+------------------------+---------------------------------------------------+\n| Comment | Other information, such as whether the index is |\n| | disabled. |\n+------------------------+---------------------------------------------------+\n| Index_comment | Contents of the COMMENT attribute when the index |\n| | was created. |\n+------------------------+---------------------------------------------------+\n| Ignored | Whether or not an index will be ignored by the |\n| | optimizer. See Ignored Indexes. From MariaDB |\n| | 10.6.0. |\n+------------------------+---------------------------------------------------+\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nExamples\n--------\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`, `position`,\n`home_address`, `home_phone`, `employee_code`)\n VALUES\n (\'Mustapha\', \'Mond\', \'Chief Executive Officer\', \'692 Promiscuous Plaza\',\n\'326-555-3492\', \'MM1\'),\n (\'Henry\', \'Foster\', \'Store Manager\', \'314 Savage Circle\', \'326-555-3847\',\n\'HF1\'),\n (\'Bernard\', \'Marx\', \'Cashier\', \'1240 Ambient Avenue\', \'326-555-8456\', \'BM1\'),\n (\'Lenina\', \'Crowne\', \'Cashier\', \'281 Bumblepuppy Boulevard\', \'328-555-2349\',\n\'LC1\'),\n (\'Fanny\', \'Crowne\', \'Restocker\', \'1023 Bokanovsky Lane\', \'326-555-6329\',\n\'FC1\'),\n (\'Helmholtz\', \'Watson\', \'Janitor\', \'944 Soma Court\', \'329-555-2478\', \'HW1\');\n\nSHOW INDEXES FROM employees_example\\G\n*************************** 1. row ***************************\n Table: employees_example\n Non_unique: 0\n Key_name: PRIMARY\n Seq_in_index: 1\n Column_name: id\n Collation: A\n Cardinality: 6\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n*************************** 2. row ***************************\n Table: employees_example\n Non_unique: 0\n Key_name: employee_code\n Seq_in_index: 1\n Column_name: employee_code\n Collation: A\n Cardinality: 6\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n*************************** 3. row ***************************\n Table: employees_example\n Non_unique: 1\n Key_name: first_name\n Seq_in_index: 1\n Column_name: first_name\n Collation: A\n Cardinality: NULL\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n*************************** 4. row ***************************\n Table: employees_example\n Non_unique: 1\n Key_name: first_name\n Seq_in_index: 2\n Column_name: last_name\n Collation: A\n Cardinality: NULL\n Sub_part: NULL\n Packed: NULL\n Null:\n Index_type: BTREE\n Comment:\nIndex_comment: \n Ignored: NO\n\nURL: https://mariadb.com/kb/en/show-index/','','https://mariadb.com/kb/en/show-index/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (342,26,'SHOW EXPLAIN','Syntax\n------\n\nSHOW EXPLAIN [FORMAT=JSON] FOR ;\nEXPLAIN [FORMAT=JSON] FOR CONNECTION ;\n\nDescription\n-----------\n\nThe SHOW EXPLAIN command allows one to get an EXPLAIN (that is, a description\nof a query plan) of a query running in a certain connection.\n\nSHOW EXPLAIN FOR ;\n\nwill produce an EXPLAIN output for the query that connection number\nconnection_id is running. The connection id can be obtained with SHOW\nPROCESSLIST.\n\nSHOW EXPLAIN FOR 1;\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n| id | select_type | table | type | possible_keys | key | key_len | ref |\nrows | Extra |\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n| 1 | SIMPLE | tbl | index | NULL | a | 5 | NULL |\n1000107 | Using index |\n+------+-------------+-------+-------+---------------+------+---------+------+-\n-------+-------------+\n1 row in set, 1 warning (0.00 sec)\n\nThe output is always accompanied with a warning which shows the query the\ntarget connection is running (this shows what the EXPLAIN is for):\n\nSHOW WARNINGS;\n+-------+------+------------------------+\n| Level | Code | Message |\n+-------+------+------------------------+\n| Note | 1003 | select sum(a) from tbl |\n+-------+------+------------------------+\n1 row in set (0.00 sec)\n\nEXPLAIN FOR CONNECTION\n----------------------\n\nMariaDB starting with 10.9\n--------------------------\nThe EXPLAIN FOR CONNECTION syntax was added for MySQL compatibility.\n\nFORMAT=JSON\n-----------\n\nMariaDB starting with 10.9\n--------------------------\nSHOW EXPLAIN [FORMAT=JSON] FOR extends SHOW EXPLAIN to return\nmore detailed JSON output.\n\nPossible Errors\n---------------\n\nThe output can be only produced if the target connection is currently running\na query, which has a ready query plan. If this is not the case, the output\nwill be:\n\nSHOW EXPLAIN FOR 2;\nERROR 1932 (HY000): Target is not running an EXPLAINable command\n\nYou will get this error when:\n\n* the target connection is not running a command for which one can run EXPLAIN\n* the target connection is running a command for which one can run EXPLAIN, but\nthere is no query plan yet (for example, tables are open and locks are\n acquired before the query plan is produced)\n\nDifferences Between SHOW EXPLAIN and EXPLAIN Outputs\n----------------------------------------------------\n\nBackground\n----------\n\nIn MySQL, EXPLAIN execution takes a slightly different route from the way the\nreal query (typically the SELECT) is optimized. This is unfortunate, and has\ncaused a number of bugs in EXPLAIN. (For example, see MDEV-326, MDEV-410, and\nlp:1013343. lp:992942 is not directly about EXPLAIN, but it also would not\nhave existed if MySQL didn\'t try to delete parts of a query plan in the middle\nof the query)\n\nSHOW EXPLAIN examines a running SELECT, and hence its output may be slightly\ndifferent from what EXPLAIN SELECT would produce. We did our best to make sure\nthat either the difference is negligible, or SHOW EXPLAIN\'s output is closer\nto reality than EXPLAIN\'s output.\n\nList of Recorded Differences\n----------------------------\n\n* SHOW EXPLAIN may have Extra=\'no matching row in const table\', where EXPLAIN\nwould produce Extra=\'Impossible WHERE ...\'\n* For queries with subqueries, SHOW EXPLAIN may print select_type==PRIMARY\nwhere regular EXPLAIN used to print select_type==SIMPLE, or vice versa.\n\nRequired Permissions\n--------------------\n\nRunning SHOW EXPLAIN requires the same permissions as running SHOW PROCESSLIST\nwould.\n\nURL: https://mariadb.com/kb/en/show-explain/','','https://mariadb.com/kb/en/show-explain/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (343,26,'BACKUP STAGE','MariaDB starting with 10.4.1\n----------------------------\nThe BACKUP STAGE commands were introduced in MariaDB 10.4.1.\n\nThe BACKUP STAGE commands are a set of commands to make it possible to make an\nefficient external backup tool.\n\nSyntax\n------\n\nBACKUP STAGE [START | FLUSH | BLOCK_DDL | BLOCK_COMMIT | END ]\n\nIn the following text, a transactional table means InnoDB or \"InnoDB-like\nengine with redo log that can lock redo purges and can be copied without locks\nby an outside process\".\n\nGoals with BACKUP STAGE Commands\n--------------------------------\n\n* To be able to do a majority of the backup with the minimum possible server\nlocks. Especially for transactional tables (InnoDB, MyRocks etc) there is only\nneed for a very short block of new commits while copying statistics and log\ntables.\n* DDL are only needed to be blocked for a very short duration of the backup\nwhile mariabackup is copying the tables affected by DDL during the initial\npart of the backup.\n* Most non transactional tables (those that are not in use) will be copied\nduring BACKUP STAGE START. The exceptions are system statistic and log tables\nthat are not blocked during the backup until BLOCK_COMMIT.\n* Should work efficiently with backup tools that use disk snapshots.\n* Should work as efficiently as possible for all table types that store data\non the local disks.\n* As little copying as possible under higher level stages/locks. For example,\n.frm (dictionary) and .trn (trigger) files should be copying while copying the\ntable data.\n\nBACKUP STAGE Commands\n---------------------\n\nBACKUP STAGE START\n------------------\n\nThe START stage is designed for the following tasks:\n\n* Blocks purge of redo files for storage engines that needs this (Aria)\n* Start logging of DDL commands into \'datadir\'/ddl.log. This may take a short\ntime as the command has to wait until there are no active DDL commands.\n\nBACKUP STAGE FLUSH\n------------------\n\nThe FLUSH stage is designed for the following tasks:\n\n* FLUSH all changes for inactive non-transactional tables, except for\nstatistics and log tables.\n* Close all tables that are not in use, to ensure they are marked as closed\nfor the backup.\n* BLOCK all new write locks for all non transactional tables (except\nstatistics and log tables). The command will not wait for tables that are in\nuse by read-only transactions.\n\nDDLs don\'t have to be blocked at this stage as they can\'t cause the table to\nbe in an inconsistent state. This is true also for non-transactional tables.\n\nBACKUP STAGE BLOCK_DDL\n----------------------\n\nThe BLOCK_DDL stage is designed for the following tasks:\n\n* Wait for all statements using write locked non-transactional tables to end.\n* Blocks CREATE TABLE, DROP TABLE, TRUNCATE TABLE, and RENAME TABLE.\n* Blocks also start off a new ALTER TABLE and the final rename phase of ALTER\nTABLE. Running ALTER TABLES are not blocked.\n\nBACKUP STAGE BLOCK_COMMIT\n-------------------------\n\nThe BLOCK_COMMIT stage is designed for the following tasks:\n\n* Lock the binary log and commit/rollback to ensure that no changes are\ncommitted to any tables. If there are active commits or data to be copied to\nthe binary log this will be allowed to finish. Active transactions will not\naffect BLOCK_COMMIT.\n* This doesn\'t lock temporary tables that are not used by replication. However\nthese will be blocked when it\'s time to write to the binary log.\n* Lock system log tables and statistics tables, flush them and mark them\nclosed.\n\nWhen the BLOCK_COMMIT\'s stages return, this is the \'backup time\'. Everything\ncommitted will be in the backup and everything not committed will roll back.\n\nTransactional engines will continue to do changes to the redo log during the\nBLOCK COMMIT stage, but this is not important as all of these will roll back\nlater as the changes will not be committed.\n\nBACKUP STAGE END\n----------------\n\nThe END stage is designed for the following tasks:\n\n* End DDL logging\n* Free resources\n\nUsing BACKUP STAGE Commands with Backup Tools\n---------------------------------------------\n\nUsing BACKUP STAGE Commands with Mariabackup\n--------------------------------------------\n\nThe BACKUP STAGE commands are a set of commands to make it possible to make an\nefficient external backup tool. How Mariabackup uses these commands depends on\nwhether you are using the version that is bundled with MariaDB Community\nServer or the version that is bundled with MariaDB Enterprise Server. See\nMariabackup and BACKUP STAGE Commands for some examples on how Mariabackup\nuses these commands.\n\nIf you would like to use a version of Mariabackup that uses the BACKUP STAGE\ncommands in an efficient way, then one option is to use MariaDB Enterprise\nBackup that is bundled with MariaDB Enterprise Server.\n\nUsing BACKUP STAGE Commands with Storage Snapshots\n--------------------------------------------------\n\nThe BACKUP STAGE commands are a set of commands to make it possible to make an\nefficient external backup tool. These commands could even be used by tools\nthat perform backups by taking a snapshot of a file system, SAN, or some other\nkind of storage device. See Storage Snapshots and BACKUP STAGE Commands for\nsome examples on how to use each BACKUP STAGE command in an efficient way.\n\nPrivileges\n----------\n\nBACKUP STAGE requires the RELOAD privilege.\n\nNotes\n-----\n\n* Only one connection can run BACKUP STAGE START. If a second connection\ntries, it will wait until the first one has executed BACKUP STAGE END.\n* If the user skips a BACKUP STAGE, then all intermediate backup stages will\nautomatically be run. This will allow us to add new stages within the BACKUP\nSTAGE hierarchy in the future with even more precise locks without causing\nproblems for tools using an earlier version of the BACKUP STAGE implementation.\n* One can use the max_statement_time or lock_wait_timeout system variables to\nensure that a BACKUP STAGE command doesn\'t block the server too long.\n* DDL logging will only be available in MariaDB Enterprise Server 10.2 and\nlater.\n* A disconnect will automatically release backup stages.\n* There is no easy way to see which is the current stage.\n\nURL: https://mariadb.com/kb/en/backup-stage/','','https://mariadb.com/kb/en/backup-stage/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (344,26,'BACKUP LOCK','MariaDB starting with 10.4.2\n----------------------------\nThe BACKUP LOCK command was introduced in MariaDB 10.4.2.\n\nBACKUP LOCK blocks a table from DDL statements. This is mainly intended to be\nused by tools like mariabackup that need to ensure there are no DDLs on a\ntable while the table files are opened. For example, for an Aria table that\nstores data in 3 files with extensions .frm, .MAI and .MAD. Normal read/write\noperations can continue as normal.\n\nSyntax\n------\n\nTo lock a table:\n\nBACKUP LOCK table_name\n\nTo unlock a table:\n\nBACKUP UNLOCK\n\nUsage in a Backup Tool\n----------------------\n\nBACKUP LOCK [database.]table_name;\n - Open all files related to a table (for example, t.frm, t.MAI and t.MYD)\nBACKUP UNLOCK;\n- Copy data\n- Close files\n\nThis ensures that all files are from the same generation, that is created at\nthe same time by the MariaDB server. This works, because the open files will\npoint to the original table files which will not be affected if there is any\nALTER TABLE while copying the files.\n\nPrivileges\n----------\n\nBACKUP LOCK requires the RELOAD privilege.\n\nNotes\n-----\n\n* The idea is that the BACKUP LOCK should be held for as short a time as\npossible by the backup tool. The time to take an uncontested lock is very\nshort! One can easily do 50,000 locks/unlocks per second on low end hardware.\n* One should use different connections for BACKUP STAGE commands and BACKUP\nLOCK.\n\nImplementation\n--------------\n\n* Internally, BACKUP LOCK is implemented by taking an MDLSHARED_HIGH_PRIO MDL\nlock on the table object, which protects the table from any DDL operations.\n\nURL: https://mariadb.com/kb/en/backup-lock/','','https://mariadb.com/kb/en/backup-lock/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (345,26,'FLUSH','Syntax\n------\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] [table_flush_option]\n\nwhere table_list is a list of tables separated by , (comma).\n\nDescription\n-----------\n\nThe FLUSH statement clears or reloads various internal caches used by MariaDB.\nTo execute FLUSH, you must have the RELOAD privilege. See GRANT.\n\nThe RESET statement is similar to FLUSH. See RESET.\n\nYou cannot issue a FLUSH statement from within a stored function or a trigger.\nDoing so within a stored procedure is permitted, as long as it is not called\nby a stored function or trigger. See Stored Routine Limitations, Stored\nFunction Limitations and Trigger Limitations.\n\nIf a listed table is a view, an error like the following will be produced:\n\nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n\nBy default, FLUSH 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\nThe different flush options are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| CHANGED_PAGE_BITMAPS | XtraDB only. Internal command used for backup |\n| | purposes. See the Information Schema |\n| | CHANGED_PAGE_BITMAPS Table. |\n+---------------------------+------------------------------------------------+\n| CLIENT_STATISTICS | Reset client statistics (see SHOW |\n| | CLIENT_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| DES_KEY_FILE | Reloads the DES key file (Specified with the |\n| | --des-key-file startup option). |\n+---------------------------+------------------------------------------------+\n| HOSTS | Flush the hostname cache (used for converting |\n| | ip to host names and for unblocking blocked |\n| | hosts. See max_connect_errors and |\n| | performance_schema.host_cache |\n+---------------------------+------------------------------------------------+\n| INDEX_STATISTICS | Reset index statistics (see SHOW |\n| | INDEX_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| [ERROR | ENGINE | | Close and reopen the specified log type, or |\n| GENERAL | SLOW | BINARY | all log types if none are specified. FLUSH |\n| | RELAY] LOGS | RELAY LOGS [connection-name] can be used to |\n| | flush the relay logs for a specific |\n| | connection. Only one connection can be |\n| | specified per FLUSH command. See Multi-source |\n| | replication. FLUSH ENGINE LOGS will delete |\n| | all unneeded Aria redo logs. Since MariaDB |\n| | 10.1.30 and MariaDB 10.2.11, FLUSH BINARY |\n| | LOGS DELETE_DOMAIN_ID=(list-of-domains) can |\n| | be used to discard obsolete GTID domains from |\n| | the server\'s binary log state. In order for |\n| | this to be successful, no event group from |\n| | the listed GTID domains can be present in |\n| | existing binary log files. If some still |\n| | exist, then they must be purged prior to |\n| | executing this command. If the command |\n| | completes successfully, then it also rotates |\n| | the binary log. |\n+---------------------------+------------------------------------------------+\n| MASTER | Deprecated option, use RESET MASTER instead. |\n+---------------------------+------------------------------------------------+\n| PRIVILEGES | Reload all privileges from the privilege |\n| | tables in the mysql database. If the server |\n| | is started with --skip-grant-table option, |\n| | this will activate the privilege tables again. |\n+---------------------------+------------------------------------------------+\n| QUERY CACHE | Defragment the query cache to better utilize |\n| | its memory. If you want to reset the query |\n| | cache, you can do it with RESET QUERY CACHE. |\n+---------------------------+------------------------------------------------+\n| QUERY_RESPONSE_TIME | See the QUERY_RESPONSE_TIME plugin. |\n+---------------------------+------------------------------------------------+\n| SLAVE | Deprecated option, use RESET REPLICA or RESET |\n| | SLAVE instead. |\n+---------------------------+------------------------------------------------+\n| SSL | Used to dynamically reinitialize the server\'s |\n| | TLS context by reloading the files defined by |\n| | several TLS system variables. See FLUSH SSL |\n| | for more information. This command was first |\n| | added in MariaDB 10.4.1. |\n+---------------------------+------------------------------------------------+\n| STATUS | Resets all server status variables that can |\n| | be reset to 0. Not all global status |\n| | variables support this, so not all global |\n| | values are reset. See FLUSH STATUS for more |\n| | information. |\n+---------------------------+------------------------------------------------+\n| TABLE | Close tables given as options or all open |\n| | tables if no table list was used. From |\n| | MariaDB 10.4.1, using without any table list |\n| | will only close tables not in use, and tables |\n| | not locked by the FLUSH TABLES connection. If |\n| | there are no locked tables, FLUSH TABLES will |\n| | be instant and will not cause any waits, as |\n| | it no longer waits for tables in use. When a |\n| | table list is provided, from MariaDB 10.4.1, |\n| | the server will wait for the end of any |\n| | transactions that are using the tables. |\n| | Previously, FLUSH TABLES only waited for the |\n| | statements to complete. |\n+---------------------------+------------------------------------------------+\n| TABLES | Same as FLUSH TABLE. |\n+---------------------------+------------------------------------------------+\n| TABLES ... FOR EXPORT | For InnoDB tables, flushes table changes to |\n| | disk to permit binary table copies while the |\n| | server is running. See FLUSH TABLES ... FOR |\n| | EXPORT for more. |\n+---------------------------+------------------------------------------------+\n| TABLES WITH READ LOCK | Closes all open tables. New tables are only |\n| | allowed to be opened with read locks until an |\n| | UNLOCK TABLES is given. |\n+---------------------------+------------------------------------------------+\n| TABLES WITH READ LOCK | As TABLES WITH READ LOCK but also disable all |\n| AND DISABLE CHECKPOINT | checkpoint writes by transactional table |\n| | engines. This is useful when doing a disk |\n| | snapshot of all tables. |\n+---------------------------+------------------------------------------------+\n| TABLE_STATISTICS | Reset table statistics (see SHOW |\n| | TABLE_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| USER_RESOURCES | Resets all per hour user resources. This |\n| | enables clients that have exhausted their |\n| | resources to connect again. |\n+---------------------------+------------------------------------------------+\n| USER_STATISTICS | Reset user statistics (see SHOW |\n| | USER_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| USER_VARIABLES | Reset user variables (see User-defined |\n| | variables). |\n+---------------------------+------------------------------------------------+\n\nYou can also use the mysqladmin client to flush things. Use mysqladmin --help\nto examine what flush commands it supports.\n\nFLUSH RELAY LOGS\n----------------\n\nFLUSH RELAY LOGS \'connection_name\';\n\nCompatibility with MySQL\n------------------------\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after the FLUSH command.\n\nFor example, one can now use:\n\nFLUSH RELAY LOGS FOR CHANNEL \'connection_name\';\n\nFLUSH STATUS\n------------\n\nServer status variables can be reset by executing the following:\n\nFLUSH STATUS;\n\nGlobal Status Variables that Support FLUSH STATUS\n-------------------------------------------------\n\nNot all global status variables support being reset by FLUSH STATUS.\nCurrently, the following status variables are reset by FLUSH STATUS:\n\n* Aborted_clients\n* Aborted_connects\n* Binlog_cache_disk_use\n* Binlog_cache_use\n* Binlog_stmt_cache_disk_use\n* Binlog_stmt_cache_use\n* Connection_errors_accept\n* Connection_errors_internal\n* Connection_errors_max_connections\n* Connection_errors_peer_address\n* Connection_errors_select\n* Connection_errors_tcpwrap\n* Created_tmp_files\n* Delayed_errors\n* Delayed_writes\n* Feature_check_constraint\n* Feature_delay_key_write\n* Max_used_connections\n* Opened_plugin_libraries\n* Performance_schema_accounts_lost\n* Performance_schema_cond_instances_lost\n* Performance_schema_digest_lost\n* Performance_schema_file_handles_lost\n* Performance_schema_file_instances_lost\n* Performance_schema_hosts_lost\n* Performance_schema_locker_lost\n* Performance_schema_mutex_instances_lost\n* Performance_schema_rwlock_instances_lost\n* Performance_schema_session_connect_attrs_lost\n* Performance_schema_socket_instances_lost\n* Performance_schema_stage_classes_lost\n* Performance_schema_statement_classes_lost\n* Performance_schema_table_handles_lost\n* Performance_schema_table_instances_lost\n* Performance_schema_thread_instances_lost\n* Performance_schema_users_lost\n* Qcache_hits\n* Qcache_inserts\n* Qcache_lowmem_prunes\n* Qcache_not_cached\n* Rpl_semi_sync_master_no_times\n* Rpl_semi_sync_master_no_tx\n* Rpl_semi_sync_master_timefunc_failures\n* Rpl_semi_sync_master_wait_pos_backtraverse\n* Rpl_semi_sync_master_yes_tx\n* Rpl_transactions_multi_engine\n* Server_audit_writes_failed\n* Slave_retried_transactions\n* Slow_launch_threads\n* Ssl_accept_renegotiates\n* Ssl_accepts\n* Ssl_callback_cache_hits\n* Ssl_client_connects\n* Ssl_connect_renegotiates\n* Ssl_ctx_verify_depth\n* Ssl_ctx_verify_mode\n* Ssl_finished_accepts\n* Ssl_finished_connects\n* Ssl_session_cache_hits\n* Ssl_session_cache_misses\n* Ssl_session_cache_overflows\n* Ssl_session_cache_size\n* Ssl_session_cache_timeouts\n* Ssl_sessions_reused\n* Ssl_used_session_cache_entries\n* Subquery_cache_hit\n* Subquery_cache_miss\n* Table_locks_immediate\n* Table_locks_waited\n* Tc_log_max_pages_used\n* Tc_log_page_waits\n* Transactions_gtid_foreign_engine\n* Transactions_multi_engine\n\nThe different usage of FLUSH TABLES\n-----------------------------------\n\nThe purpose of FLUSH TABLES\n---------------------------\n\nThe purpose of FLUSH TABLES is to clean up the open table cache and table\ndefinition cache from not in use tables. This frees up memory and file\ndescriptors. Normally this is not needed as the caches works on a FIFO bases,\nbut can be useful if the server seams to use up to much memory for some reason.\n\nThe purpose of FLUSH TABLES WITH READ LOCK \n-------------------------------------------\n\nFLUSH TABLES WITH READ LOCK is useful if you want to take a backup of some\ntables. When FLUSH TABLES WITH READ LOCK returns, all write access to tables\nare blocked and all tables are marked as \'properly closed\' on disk. The tables\ncan still be used for read operations.\n\nThe purpose of FLUSH TABLES table_list\n--------------------------------------\n\nFLUSH TABLES table_list is useful if you want to copy a table object/files to\nor from the server. This command puts a lock that stops new users of the table\nand will wait until everyone has stopped using the table. The table is then\nremoved from the table definition and table cache.\n\nNote that it\'s up to the user to ensure that no one is accessing the table\nbetween FLUSH TABLES and the table is copied to or from the server. This can\nbe secured by using LOCK TABLES.\n','','https://mariadb.com/kb/en/flush/'); -update help_topic set description = CONCAT(description, '\nIf there are any tables locked by the connection that is using FLUSH TABLES\nall the locked tables will be closed as part of the flush and reopened and\nrelocked before FLUSH TABLES returns. This allows one to copy the table after\nFLUSH TABLES returns without having any writes on the table. For now this\nworks works with most tables, except InnoDB as InnoDB may do background purges\non the table even while it\'s write locked.\n\nThe purpose of FLUSH TABLES table_list WITH READ LOCK\n-----------------------------------------------------\n\nFLUSH TABLES table_list WITH READ LOCK should work as FLUSH TABLES WITH READ\nLOCK, but only those tables that are listed will be properly closed. However\nin practice this works exactly like FLUSH TABLES WITH READ LOCK as the FLUSH\ncommand has anyway to wait for all WRITE operations to end because we are\ndepending on a global read lock for this code. In the future we should\nconsider fixing this to instead use meta data locks.\n\nImplementation of FLUSH TABLES commands in MariaDB 10.4.8 and above\n-------------------------------------------------------------------\n\nImplementation of FLUSH TABLES\n------------------------------\n\n* Free memory and file descriptors not in use\n\nImplementation of FLUSH TABLES WITH READ LOCK\n---------------------------------------------\n\n* Lock all tables read only for simple old style backup.\n* All background writes are suspended and tables are marked as closed.\n* No statement requiring table changes are allowed for any user until UNLOCK\nTABLES.\n\nInstead of using FLUSH TABLE WITH READ LOCK one should in most cases instead\nuse BACKUP STAGE BLOCK_COMMIT.\n\nImplementation of FLUSH TABLES table_list\n-----------------------------------------\n\n* Free memory and file descriptors for tables not in use from table list.\n* Lock given tables as read only.\n* Wait until all translations has ended that uses any of the given tables.\n* Wait until all background writes are suspended and tables are marked as\nclosed.\n\nImplementation of FLUSH TABLES table_list FOR EXPORT\n----------------------------------------------------\n\n* Free memory and file descriptors for tables not in use from table list\n* Lock given tables as read.\n* Wait until all background writes are suspended and tables are marked as\nclosed.\n* Check that all tables supports FOR EXPORT\n* No changes to these tables allowed until UNLOCK TABLES\n\nThis is basically the same behavior as in old MariaDB version if one first\nlock the tables, then do FLUSH TABLES. The tables will be copyable until\nUNLOCK TABLES.\n\nFLUSH SSL\n---------\n\nMariaDB starting with 10.4\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 to dynamically\nreinitialize the server\'s TLS context. This is most useful if you need to\nreplace a certificate that is about to expire without restarting the server.\n\nThis operation is performed by reloading the files defined by the following\nTLS system variables:\n\n* ssl_cert\n* ssl_key\n* ssl_ca\n* ssl_capath\n* ssl_crl\n* ssl_crlpath\n\nThese TLS system variables are not dynamic, so their values can not be changed\nwithout restarting the server.\n\nIf you want to dynamically reinitialize the server\'s TLS context, then you\nneed to change the certificate and key files at the relevant paths defined by\nthese TLS system variables, without actually changing the values of the\nvariables. See MDEV-19341 for more information.\n\nReducing Memory Usage\n---------------------\n\nTo flush some of the global caches that take up memory, you could execute the\nfollowing command:\n\nFLUSH LOCAL HOSTS,\n QUERY CACHE,\n TABLE_STATISTICS,\n INDEX_STATISTICS,\n USER_STATISTICS;\n\nURL: https://mariadb.com/kb/en/flush/') WHERE help_topic_id = 345; +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (345,26,'FLUSH','Syntax\n------\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] [table_flush_option]\n\nwhere table_list is a list of tables separated by , (comma).\n\nDescription\n-----------\n\nThe FLUSH statement clears or reloads various internal caches used by MariaDB.\nTo execute FLUSH, you must have the RELOAD privilege. See GRANT.\n\nThe RESET statement is similar to FLUSH. See RESET.\n\nYou cannot issue a FLUSH statement from within a stored function or a trigger.\nDoing so within a stored procedure is permitted, as long as it is not called\nby a stored function or trigger. See Stored Routine Limitations, Stored\nFunction Limitations and Trigger Limitations.\n\nIf a listed table is a view, an error like the following will be produced:\n\nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n\nBy default, FLUSH 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\nThe different flush options are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| CHANGED_PAGE_BITMAPS | XtraDB only. Internal command used for backup |\n| | purposes. See the Information Schema |\n| | CHANGED_PAGE_BITMAPS Table. |\n+---------------------------+------------------------------------------------+\n| CLIENT_STATISTICS | Reset client statistics (see SHOW |\n| | CLIENT_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| DES_KEY_FILE | Reloads the DES key file (Specified with the |\n| | --des-key-file startup option). |\n+---------------------------+------------------------------------------------+\n| HOSTS | Flush the hostname cache (used for converting |\n| | ip to host names and for unblocking blocked |\n| | hosts. See max_connect_errors and |\n| | performance_schema.host_cache |\n+---------------------------+------------------------------------------------+\n| INDEX_STATISTICS | Reset index statistics (see SHOW |\n| | INDEX_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| [ERROR | ENGINE | | Close and reopen the specified log type, or |\n| GENERAL | SLOW | BINARY | all log types if none are specified. FLUSH |\n| | RELAY] LOGS | RELAY LOGS [connection-name] can be used to |\n| | flush the relay logs for a specific |\n| | connection. Only one connection can be |\n| | specified per FLUSH command. See Multi-source |\n| | replication. FLUSH ENGINE LOGS will delete |\n| | all unneeded Aria redo logs. FLUSH BINARY |\n| | LOGS DELETE_DOMAIN_ID=(list-of-domains) can |\n| | be used to discard obsolete GTID domains from |\n| | the server\'s binary log state. In order for |\n| | this to be successful, no event group from |\n| | the listed GTID domains can be present in |\n| | existing binary log files. If some still |\n| | exist, then they must be purged prior to |\n| | executing this command. If the command |\n| | completes successfully, then it also rotates |\n| | the binary log. |\n+---------------------------+------------------------------------------------+\n| MASTER | Deprecated option, use RESET MASTER instead. |\n+---------------------------+------------------------------------------------+\n| PRIVILEGES | Reload all privileges from the privilege |\n| | tables in the mysql database. If the server |\n| | is started with --skip-grant-table option, |\n| | this will activate the privilege tables again. |\n+---------------------------+------------------------------------------------+\n| QUERY CACHE | Defragment the query cache to better utilize |\n| | its memory. If you want to reset the query |\n| | cache, you can do it with RESET QUERY CACHE. |\n+---------------------------+------------------------------------------------+\n| QUERY_RESPONSE_TIME | See the QUERY_RESPONSE_TIME plugin. |\n+---------------------------+------------------------------------------------+\n| SLAVE | Deprecated option, use RESET REPLICA or RESET |\n| | SLAVE instead. |\n+---------------------------+------------------------------------------------+\n| SSL | Used to dynamically reinitialize the server\'s |\n| | TLS context by reloading the files defined by |\n| | several TLS system variables. See FLUSH SSL |\n| | for more information. |\n+---------------------------+------------------------------------------------+\n| STATUS | Resets all server status variables that can |\n| | be reset to 0. Not all global status |\n| | variables support this, so not all global |\n| | values are reset. See FLUSH STATUS for more |\n| | information. |\n+---------------------------+------------------------------------------------+\n| TABLE | Close tables given as options or all open |\n| | tables if no table list was used. From |\n| | MariaDB 10.4.1, using without any table list |\n| | will only close tables not in use, and tables |\n| | not locked by the FLUSH TABLES connection. If |\n| | there are no locked tables, FLUSH TABLES will |\n| | be instant and will not cause any waits, as |\n| | it no longer waits for tables in use. When a |\n| | table list is provided, from MariaDB 10.4.1, |\n| | the server will wait for the end of any |\n| | transactions that are using the tables. |\n| | Previously, FLUSH TABLES only waited for the |\n| | statements to complete. |\n+---------------------------+------------------------------------------------+\n| TABLES | Same as FLUSH TABLE. |\n+---------------------------+------------------------------------------------+\n| TABLES ... FOR EXPORT | For InnoDB tables, flushes table changes to |\n| | disk to permit binary table copies while the |\n| | server is running. See FLUSH TABLES ... FOR |\n| | EXPORT for more. |\n+---------------------------+------------------------------------------------+\n| TABLES WITH READ LOCK | Closes all open tables. New tables are only |\n| | allowed to be opened with read locks until an |\n| | UNLOCK TABLES is given. |\n+---------------------------+------------------------------------------------+\n| TABLES WITH READ LOCK | As TABLES WITH READ LOCK but also disable all |\n| AND DISABLE CHECKPOINT | checkpoint writes by transactional table |\n| | engines. This is useful when doing a disk |\n| | snapshot of all tables. |\n+---------------------------+------------------------------------------------+\n| TABLE_STATISTICS | Reset table statistics (see SHOW |\n| | TABLE_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| USER_RESOURCES | Resets all per hour user resources. This |\n| | enables clients that have exhausted their |\n| | resources to connect again. |\n+---------------------------+------------------------------------------------+\n| USER_STATISTICS | Reset user statistics (see SHOW |\n| | USER_STATISTICS). |\n+---------------------------+------------------------------------------------+\n| USER_VARIABLES | Reset user variables (see User-defined |\n| | variables). |\n+---------------------------+------------------------------------------------+\n\nYou can also use the mariadb-admin client to flush things. Use mariadb-admin\n--help to examine what flush commands it supports.\n\nFLUSH RELAY LOGS\n----------------\n\nFLUSH RELAY LOGS \'connection_name\';\n\nCompatibility with MySQL\n------------------------\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after the FLUSH command.\n\nFor example, one can now use:\n\nFLUSH RELAY LOGS FOR CHANNEL \'connection_name\';\n\nFLUSH STATUS\n------------\n\nServer status variables can be reset by executing the following:\n\nFLUSH STATUS;\n\nGlobal Status Variables that Support FLUSH STATUS\n-------------------------------------------------\n\nNot all global status variables support being reset by FLUSH STATUS.\nCurrently, the following status variables are reset by FLUSH STATUS:\n\n* Aborted_clients\n* Aborted_connects\n* Binlog_cache_disk_use\n* Binlog_cache_use\n* Binlog_stmt_cache_disk_use\n* Binlog_stmt_cache_use\n* Connection_errors_accept\n* Connection_errors_internal\n* Connection_errors_max_connections\n* Connection_errors_peer_address\n* Connection_errors_select\n* Connection_errors_tcpwrap\n* Created_tmp_files\n* Delayed_errors\n* Delayed_writes\n* Feature_check_constraint\n* Feature_delay_key_write\n* Max_used_connections\n* Opened_plugin_libraries\n* Performance_schema_accounts_lost\n* Performance_schema_cond_instances_lost\n* Performance_schema_digest_lost\n* Performance_schema_file_handles_lost\n* Performance_schema_file_instances_lost\n* Performance_schema_hosts_lost\n* Performance_schema_locker_lost\n* Performance_schema_mutex_instances_lost\n* Performance_schema_rwlock_instances_lost\n* Performance_schema_session_connect_attrs_lost\n* Performance_schema_socket_instances_lost\n* Performance_schema_stage_classes_lost\n* Performance_schema_statement_classes_lost\n* Performance_schema_table_handles_lost\n* Performance_schema_table_instances_lost\n* Performance_schema_thread_instances_lost\n* Performance_schema_users_lost\n* Qcache_hits\n* Qcache_inserts\n* Qcache_lowmem_prunes\n* Qcache_not_cached\n* Rpl_semi_sync_master_no_times\n* Rpl_semi_sync_master_no_tx\n* Rpl_semi_sync_master_timefunc_failures\n* Rpl_semi_sync_master_wait_pos_backtraverse\n* Rpl_semi_sync_master_yes_tx\n* Rpl_transactions_multi_engine\n* Server_audit_writes_failed\n* Slave_retried_transactions\n* Slow_launch_threads\n* Ssl_accept_renegotiates\n* Ssl_accepts\n* Ssl_callback_cache_hits\n* Ssl_client_connects\n* Ssl_connect_renegotiates\n* Ssl_ctx_verify_depth\n* Ssl_ctx_verify_mode\n* Ssl_finished_accepts\n* Ssl_finished_connects\n* Ssl_session_cache_hits\n* Ssl_session_cache_misses\n* Ssl_session_cache_overflows\n* Ssl_session_cache_size\n* Ssl_session_cache_timeouts\n* Ssl_sessions_reused\n* Ssl_used_session_cache_entries\n* Subquery_cache_hit\n* Subquery_cache_miss\n* Table_locks_immediate\n* Table_locks_waited\n* Tc_log_max_pages_used\n* Tc_log_page_waits\n* Transactions_gtid_foreign_engine\n* Transactions_multi_engine\n\nThe different usage of FLUSH TABLES\n-----------------------------------\n\nThe purpose of FLUSH TABLES\n---------------------------\n\nThe purpose of FLUSH TABLES is to clean up the open table cache and table\ndefinition cache from not in use tables. This frees up memory and file\ndescriptors. Normally this is not needed as the caches works on a FIFO bases,\nbut can be useful if the server seams to use up to much memory for some reason.\n\nThe purpose of FLUSH TABLES WITH READ LOCK \n-------------------------------------------\n\nFLUSH TABLES WITH READ LOCK is useful if you want to take a backup of some\ntables. When FLUSH TABLES WITH READ LOCK returns, all write access to tables\nare blocked and all tables are marked as \'properly closed\' on disk. The tables\ncan still be used for read operations.\n\nThe purpose of FLUSH TABLES table_list\n--------------------------------------\n\nFLUSH TABLES table_list is useful if you want to copy a table object/files to\nor from the server. This command puts a lock that stops new users of the table\nand will wait until everyone has stopped using the table. The table is then\nremoved from the table definition and table cache.\n\nNote that it\'s up to the user to ensure that no one is accessing the table\nbetween FLUSH TABLES and the table is copied to or from the server. This can\nbe secured by using LOCK TABLES.\n\nIf there are any tables locked by the connection that is using FLUSH TABLES\nall the locked tables will be closed as part of the flush and reopened and','','https://mariadb.com/kb/en/flush/'); +update help_topic set description = CONCAT(description, '\nrelocked before FLUSH TABLES returns. This allows one to copy the table after\nFLUSH TABLES returns without having any writes on the table. For now this\nworks works with most tables, except InnoDB as InnoDB may do background purges\non the table even while it\'s write locked.\n\nThe purpose of FLUSH TABLES table_list WITH READ LOCK\n-----------------------------------------------------\n\nFLUSH TABLES table_list WITH READ LOCK should work as FLUSH TABLES WITH READ\nLOCK, but only those tables that are listed will be properly closed. However\nin practice this works exactly like FLUSH TABLES WITH READ LOCK as the FLUSH\ncommand has anyway to wait for all WRITE operations to end because we are\ndepending on a global read lock for this code. In the future we should\nconsider fixing this to instead use meta data locks.\n\nImplementation of FLUSH TABLES commands in MariaDB 10.4.8 and above\n-------------------------------------------------------------------\n\nImplementation of FLUSH TABLES\n------------------------------\n\n* Free memory and file descriptors not in use\n\nImplementation of FLUSH TABLES WITH READ LOCK\n---------------------------------------------\n\n* Lock all tables read only for simple old style backup.\n* All background writes are suspended and tables are marked as closed.\n* No statement requiring table changes are allowed for any user until UNLOCK\nTABLES.\n\nInstead of using FLUSH TABLE WITH READ LOCK one should in most cases instead\nuse BACKUP STAGE BLOCK_COMMIT.\n\nImplementation of FLUSH TABLES table_list\n-----------------------------------------\n\n* Free memory and file descriptors for tables not in use from table list.\n* Lock given tables as read only.\n* Wait until all translations has ended that uses any of the given tables.\n* Wait until all background writes are suspended and tables are marked as\nclosed.\n\nImplementation of FLUSH TABLES table_list FOR EXPORT\n----------------------------------------------------\n\n* Free memory and file descriptors for tables not in use from table list\n* Lock given tables as read.\n* Wait until all background writes are suspended and tables are marked as\nclosed.\n* Check that all tables supports FOR EXPORT\n* No changes to these tables allowed until UNLOCK TABLES\n\nThis is basically the same behavior as in old MariaDB version if one first\nlock the tables, then do FLUSH TABLES. The tables will be copyable until\nUNLOCK TABLES.\n\nFLUSH SSL\n---------\n\nMariaDB starting with 10.4\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 to dynamically\nreinitialize the server\'s TLS context. This is most useful if you need to\nreplace a certificate that is about to expire without restarting the server.\n\nThis operation is performed by reloading the files defined by the following\nTLS system variables:\n\n* ssl_cert\n* ssl_key\n* ssl_ca\n* ssl_capath\n* ssl_crl\n* ssl_crlpath\n\nThese TLS system variables are not dynamic, so their values can not be changed\nwithout restarting the server.\n\nIf you want to dynamically reinitialize the server\'s TLS context, then you\nneed to change the certificate and key files at the relevant paths defined by\nthese TLS system variables, without actually changing the values of the\nvariables. See MDEV-19341 for more information.\n\nReducing Memory Usage\n---------------------\n\nTo flush some of the global caches that take up memory, you could execute the\nfollowing command:\n\nFLUSH LOCAL HOSTS,\n QUERY CACHE,\n TABLE_STATISTICS,\n INDEX_STATISTICS,\n USER_STATISTICS;\n\nURL: https://mariadb.com/kb/en/flush/') WHERE help_topic_id = 345; insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (346,26,'FLUSH QUERY CACHE','Description\n-----------\n\nYou can defragment the query cache to better utilize its memory with the FLUSH\nQUERY CACHE statement. The statement does not remove any queries from the\ncache.\n\nThe RESET QUERY CACHE statement removes all query results from the query\ncache. The FLUSH TABLES statement also does this.\n\nURL: https://mariadb.com/kb/en/flush-query-cache/','','https://mariadb.com/kb/en/flush-query-cache/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (347,26,'FLUSH TABLES FOR EXPORT','Syntax\n------\n\nFLUSH TABLES table_name [, table_name] FOR EXPORT\n\nDescription\n-----------\n\nFLUSH TABLES ... FOR EXPORT flushes changes to the specified tables to disk so\nthat binary copies can be made while the server is still running. This works\nfor Archive, Aria, CSV, InnoDB, 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 EXPORT, a 1031 error\n(SQLSTATE \'HY000\') is produced.\n\nIf FLUSH TABLES ... FOR EXPORT is in effect in the session, the following\nstatements will produce an error if attempted:\n\n* FLUSH TABLES WITH READ LOCK\n* FLUSH TABLES ... WITH READ LOCK\n* FLUSH TABLES ... FOR EXPORT\n* Any statement trying to update any table\n\nIf any of the following statements is in effect in the session, attempting\nFLUSH TABLES ... FOR EXPORT will produce an error.\n\n* FLUSH TABLES ... WITH READ LOCK\n* FLUSH TABLES ... FOR EXPORT\n* LOCK TABLES ... READ\n* LOCK TABLES ... WRITE\n\nFLUSH FOR EXPORT is not written to the binary log.\n\nThis statement requires the RELOAD and the LOCK TABLES privileges.\n\nIf one of the specified tables cannot be locked, none of the tables will be\nlocked.\n\nIf a table does not exist, an error like the following will be 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 produced:\n\nERROR 1347 (HY000): \'test.v\' is not BASE TABLE\n\nExample\n-------\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\nURL: https://mariadb.com/kb/en/flush-tables-for-export/','','https://mariadb.com/kb/en/flush-tables-for-export/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (348,26,'SHOW RELAYLOG EVENTS','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nSHOW RELAYLOG [\'connection_name\'] EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n [ FOR CHANNEL \'channel_name\']\n\nDescription\n-----------\n\nOn replicas, this command shows the events in the relay log. If \'log_name\' is\nnot specified, the first relay log is shown.\n\nSyntax for the LIMIT clause is the same as for SELECT ... LIMIT.\n\nUsing the LIMIT clause is highly recommended because the SHOW RELAYLOG EVENTS\ncommand returns the complete contents of the relay log, which can be quite\nlarge.\n\nThis command does not return events related to setting user and system\nvariables. If you need those, use mariadb-binlog/mysqlbinlog.\n\nOn the primary, this command does nothing.\n\nRequires the REPLICA MONITOR privilege (>= MariaDB 10.5.9), the REPLICATION\nSLAVE ADMIN privilege (>= MariaDB 10.5.2) or the REPLICATION SLAVE privilege\n(<= MariaDB 10.5.1).\n\nconnection_name\n---------------\n\nIf there is only one nameless primary, or the default primary (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the SHOW RELAYLOG statement will apply to the\nspecified primary. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after SHOW RELAYLOG.\n\nURL: https://mariadb.com/kb/en/show-relaylog-events/','','https://mariadb.com/kb/en/show-relaylog-events/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (349,26,'SHOW SLAVE STATUS','Syntax\n------\n\nSHOW SLAVE [\"connection_name\"] STATUS [FOR CHANNEL \"connection_name\"]\nSHOW REPLICA [\"connection_name\"] STATUS -- From MariaDB 10.5.1\n\nor\n\nSHOW ALL SLAVES STATUS\nSHOW ALL REPLICAS STATUS -- From MariaDB 10.5.1\n\nDescription\n-----------\n\nThis statement is to be run on a replica and provides status information on\nessential parameters of the replica threads.\n\nThis statement requires the SUPER privilege, the REPLICATION_CLIENT privilege,\nor, from MariaDB 10.5.2, the REPLICATION SLAVE ADMIN privilege, or, from\nMariaDB 10.5.9, the REPLICA MONITOR privilege.\n\nMulti-Source\n------------\n\nThe ALL and \"connection_name\" options allow you to connect to many primaries\nat the same time.\n\nALL SLAVES (or ALL REPLICAS from MariaDB 10.5.1) gives you a list of all\nconnections to the primary nodes.\n\nThe rows will be sorted according to Connection_name.\n\nIf you specify a connection_name, you only get the information about that\nconnection. If connection_name is not used, then the name set by\ndefault_master_connection is used. If the connection name doesn\'t exist you\nwill get an error: There is no master connection for \'xxx\'.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after SHOW SLAVE.\n\nColumn Descriptions\n-------------------\n\n+---------------+---------------------------------------+-------------------+\n| Name | Description | Added |\n+---------------+---------------------------------------+-------------------+\n| Connection_na | Name of the primary connection. | |\n| e | Returned with SHOW ALL SLAVES STATUS | |\n| | (or SHOW ALL REPLICAS STATUS from | |\n| | MariaDB 10.5.1) only. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_SQL_Sta | State of SQL thread. Returned with | |\n| e | SHOW ALL SLAVES STATUS (or SHOW ALL | |\n| | REPLICAS STATUS from MariaDB 10.5.1) | |\n| | only. See Slave SQL Thread States. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_IO_Stat | State of I/O thread. See Slave I/O | |\n| | Thread States. | |\n+---------------+---------------------------------------+-------------------+\n| Master_host | Master host that the replica is | |\n| | connected to. | |\n+---------------+---------------------------------------+-------------------+\n| Master_user | Account user name being used to | |\n| | connect to the primary. | |\n+---------------+---------------------------------------+-------------------+\n| Master_port | The port being used to connect to | |\n| | the primary. | |\n+---------------+---------------------------------------+-------------------+\n| Connect_Retry | Time in seconds between retries to | |\n| | connect. The default is 60. The | |\n| | CHANGE MASTER TO statement can set | |\n| | this. The master-retry-count option | |\n| | determines the maximum number of | |\n| | reconnection attempts. | |\n+---------------+---------------------------------------+-------------------+\n| Master_Log_Fi | Name of the primary binary log file | |\n| e | that the I/O thread is currently | |\n| | reading from. | |\n+---------------+---------------------------------------+-------------------+\n| Read_Master_L | Position up to which the I/O thread | |\n| g_Pos | has read in the current primary | |\n| | binary log file. | |\n+---------------+---------------------------------------+-------------------+\n| Relay_Log_Fil | Name of the relay log file that the | |\n| | SQL thread is currently processing. | |\n+---------------+---------------------------------------+-------------------+\n| Relay_Log_Pos | Position up to which the SQL thread | |\n| | has finished processing in the | |\n| | current relay log file. | |\n+---------------+---------------------------------------+-------------------+\n| Relay_Master_ | Name of the primary binary log file | |\n| og_File | that contains the most recent event | |\n| | executed by the SQL thread. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_IO_Runn | Whether the replica I/O thread is | |\n| ng | running and connected (Yes), running | |\n| | but not connected to a primary | |\n| | (Connecting) or not running (No). | |\n+---------------+---------------------------------------+-------------------+\n| Slave_SQL_Run | Whether or not the SQL thread is | |\n| ing | running. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Do_ | Databases specified for replicating | |\n| B | with the replicate_do_db option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Ign | Databases specified for ignoring | |\n| re_DB | with the replicate_ignore_db option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Do_ | Tables specified for replicating | |\n| able | with the replicate_do_table option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Ign | Tables specified for ignoring with | |\n| re_Table | the replicate_ignore_table option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Wil | Tables specified for replicating | |\n| _Do_Table | with the replicate_wild_do_table | |\n| | option. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Wil | Tables specified for ignoring with | |\n| _Ignore_Table | the replicate_wild_ignore_table | |\n| | option. | |\n+---------------+---------------------------------------+-------------------+\n| Last_Errno | Alias for Last_SQL_Errno (see below) | |\n+---------------+---------------------------------------+-------------------+\n| Last Error | Alias for Last_SQL_Error (see below) | |\n+---------------+---------------------------------------+-------------------+\n| Skip_Counter | Number of events that a replica | |\n| | skips from the master, as recorded | |\n| | in the sql_slave_skip_counter system | |\n| | variable. | |\n+---------------+---------------------------------------+-------------------+\n| Exec_Master_L | Position up to which the SQL thread | |\n| g_Pos | has processed in the current master | |\n| | binary log file. Can be used to | |\n| | start a new replica from a current | |\n| | replica with the CHANGE MASTER TO | |\n| | ... MASTER_LOG_POS option. | |\n+---------------+---------------------------------------+-------------------+\n| Relay_Log_Spa | Total size of all relay log files | |\n| e | combined. | |\n+---------------+---------------------------------------+-------------------+\n| Until_Conditi | | |\n| n | | |\n+---------------+---------------------------------------+-------------------+\n| Until_Log_Fil | The MASTER_LOG_FILE value of the | |\n| | START SLAVE UNTIL condition. | |\n+---------------+---------------------------------------+-------------------+\n| Until_Log_Pos | The MASTER_LOG_POS value of the | |\n| | START SLAVE UNTIL condition. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Al | Whether an SSL connection is | |\n| owed | permitted (Yes), not permitted (No) | |\n| | or permitted but without the replica | |\n| | having SSL support enabled (Ignored) | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_CA | The MASTER_SSL_CA option of the | |\n| File | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_CA | The MASTER_SSL_CAPATH option of the | |\n| Path | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Ce | The MASTER_SSL_CERT option of the | |\n| t | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Ci | The MASTER_SSL_CIPHER option of the | |\n| her | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Ke | The MASTER_SSL_KEY option of the | |\n| | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Seconds_Behin | Difference between the timestamp | |\n| _Master | logged on the master for the event | |\n| | that the replica is currently | |\n| | processing, and the current | |\n| | timestamp on the replica. Zero if | |\n| | the replica is not currently | |\n| | processing an event. With parallel | |\n| | replication, seconds_behind_master | |\n| | is updated only after transactions | |\n| | commit. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Ve | The MASTER_SSL_VERIFY_SERVER_CERT | |\n| ify_Server_Ce | option of the CHANGE MASTER TO | |\n| t | statement. | |\n+---------------+---------------------------------------+-------------------+\n| Last_IO_Errno | Error code of the most recent error | |\n| | that caused the I/O thread to stop | |\n| | (also recorded in the replica\'s | |\n| | error log). 0 means no error. RESET | |\n| | SLAVE or RESET MASTER will reset | |\n| | this value. | |\n+---------------+---------------------------------------+-------------------+\n| Last_IO_Error | Error message of the most recent | |\n| | error that caused the I/O thread to | |\n| | stop (also recorded in the replica\'s | |\n| | error log). An empty string means no | |\n| | error. RESET SLAVE or RESET MASTER | |\n| | will reset this value. | |\n+---------------+---------------------------------------+-------------------+\n| Last_SQL_Errn | Error code of the most recent error | |\n| | that caused the SQL thread to stop | |\n| | (also recorded in the replica\'s | |\n| | error log). 0 means no error. RESET | |\n| | SLAVE or RESET MASTER will reset | |\n| | this value. | |\n+---------------+---------------------------------------+-------------------+\n| Last_SQL_Erro | Error message of the most recent | |\n| | error that caused the SQL thread to | |\n| | stop (also recorded in the replica\'s | |','','https://mariadb.com/kb/en/show-replica-status/'); -update help_topic set description = CONCAT(description, '\n| | error log). An empty string means no | |\n| | error. RESET SLAVE or RESET MASTER | |\n| | will reset this value. | |\n+---------------+---------------------------------------+-------------------+\n| Replicate_Ign | List of server_ids that are | |\n| re_Server_Ids | currently being ignored for | |\n| | replication purposes, or an empty | |\n| | string for none, as specified in the | |\n| | IGNORE_SERVER_IDS option of the | |\n| | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_Server | The master\'s server_id value. | |\n| Id | | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Cr | The MASTER_SSL_CRL option of the | |\n| | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Master_SSL_Cr | The MASTER_SSL_CRLPATH option of the | |\n| path | CHANGE MASTER TO statement. | |\n+---------------+---------------------------------------+-------------------+\n| Using_Gtid | Whether or not global transaction | |\n| | ID\'s are being used for replication | |\n| | (can be No, Slave_Pos, or | |\n| | Current_Pos). | |\n+---------------+---------------------------------------+-------------------+\n| Gtid_IO_Pos | Current global transaction ID value. | |\n+---------------+---------------------------------------+-------------------+\n| Retried_trans | Number of retried transactions for | |\n| ctions | this connection. Returned with SHOW | |\n| | ALL SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| Max_relay_log | Max relay log size for this | |\n| size | connection. Returned with SHOW ALL | |\n| | SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| Executed_log_ | How many log entries the replica has | |\n| ntries | executed. Returned with SHOW ALL | |\n| | SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_receive | How many heartbeats we have got from | |\n| _heartbeats | the master. Returned with SHOW ALL | |\n| | SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_heartbe | How often to request a heartbeat | |\n| t_period | packet from the master (in seconds). | |\n| | Returned with SHOW ALL SLAVES STATUS | |\n| | only. | |\n+---------------+---------------------------------------+-------------------+\n| Gtid_Slave_Po | GTID of the last event group | |\n| | replicated on a replica server, for | |\n| | each replication domain, as stored | |\n| | in the gtid_slave_pos system | |\n| | variable. Returned with SHOW ALL | |\n| | SLAVES STATUS only. | |\n+---------------+---------------------------------------+-------------------+\n| SQL_Delay | Value specified by MASTER_DELAY in | MariaDB 10.2.3 |\n| | CHANGE MASTER (or 0 if none). | |\n+---------------+---------------------------------------+-------------------+\n| SQL_Remaining | When the replica is delaying the | MariaDB 10.2.3 |\n| Delay | execution of an event due to | |\n| | MASTER_DELAY, this is the number of | |\n| | seconds of delay remaining before | |\n| | the event will be applied. | |\n| | Otherwise, the value is NULL. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_SQL_Run | The state of the SQL driver threads, | MariaDB 10.2.3 |\n| ing_State | same as in SHOW PROCESSLIST. When | |\n| | the replica is delaying the | |\n| | execution of an event due to | |\n| | MASTER_DELAY, this field displays: | |\n| | \"Waiting until MASTER_DELAY seconds | |\n| | after master executed event\". | |\n+---------------+---------------------------------------+-------------------+\n| Slave_DDL_Gro | This status variable counts the | MariaDB 10.3.7 |\n| ps | occurrence of DDL statements. This | |\n| | is a replica-side counter for | |\n| | optimistic parallel replication. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_Non_Tra | This status variable counts the | MariaDB 10.3.7 |\n| sactional_Gro | occurrence of non-transactional | |\n| ps | event groups. This is a | |\n| | replica-side counter for optimistic | |\n| | parallel replication. | |\n+---------------+---------------------------------------+-------------------+\n| Slave_Transac | This status variable counts the | MariaDB 10.3.7 |\n| ional_Groups | occurrence of transactional event | |\n| | groups. This is a replica-side | |\n| | counter for optimistic parallel | |\n| | replication. | |\n+---------------+---------------------------------------+-------------------+\n\nSHOW REPLICA STATUS\n-------------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSHOW REPLICA STATUS is an alias for SHOW SLAVE STATUS from MariaDB 10.5.1.\n\nExamples\n--------\n\nIf you issue this statement using the mysql client, you can use a \\G statement\nterminator rather than a semicolon to obtain a more readable vertical layout.\n\nSHOW SLAVE STATUS\\G\n*************************** 1. row ***************************\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\nSHOW ALL SLAVES STATUS\\G\n*************************** 1. row ***************************\n Connection_name:\n Slave_SQL_State: Slave has read all relay log; waiting for the\nslave 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 status 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\nURL: https://mariadb.com/kb/en/show-replica-status/') WHERE help_topic_id = 349; +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (348,26,'SHOW RELAYLOG EVENTS','The terms master and slave have historically been used in replication, but the\nterms terms primary and replica are now preferred. The old terms are used\nstill used in parts of the documentation, and in MariaDB commands, although\nMariaDB 10.5 has begun the process of renaming. The documentation process is\nongoing. See MDEV-18777 to follow progress on this effort.\n\nSyntax\n------\n\nSHOW RELAYLOG [\'connection_name\'] EVENTS\n [IN \'log_name\'] [FROM pos] [LIMIT [offset,] row_count]\n [ FOR CHANNEL \'channel_name\']\n\nDescription\n-----------\n\nOn replicas, this command shows the events in the relay log. If \'log_name\' is\nnot specified, the first relay log is shown.\n\nSyntax for the LIMIT clause is the same as for SELECT ... LIMIT.\n\nUsing the LIMIT clause is highly recommended because the SHOW RELAYLOG EVENTS\ncommand returns the complete contents of the relay log, which can be quite\nlarge.\n\nThis command does not return events related to setting user and system\nvariables. If you need those, use mariadb-binlog.\n\nOn the primary, this command does nothing.\n\nRequires the REPLICA MONITOR privilege (>= MariaDB 10.5.9), the REPLICATION\nSLAVE ADMIN privilege (>= MariaDB 10.5.2) or the REPLICATION SLAVE privilege\n(<= MariaDB 10.5.1).\n\nconnection_name\n---------------\n\nIf there is only one nameless primary, or the default primary (as specified by\nthe default_master_connection system variable) is intended, connection_name\ncan be omitted. If provided, the SHOW RELAYLOG statement will apply to the\nspecified primary. connection_name is case-insensitive.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nas using the channel_name directly after SHOW RELAYLOG.\n\nURL: https://mariadb.com/kb/en/show-relaylog-events/','','https://mariadb.com/kb/en/show-relaylog-events/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (349,26,'SHOW SLAVE STATUS','Syntax\n------\n\nSHOW SLAVE [\"connection_name\"] STATUS [FOR CHANNEL \"connection_name\"]\nSHOW REPLICA [\"connection_name\"] STATUS -- From MariaDB 10.5.1\n\nor\n\nSHOW ALL SLAVES STATUS\nSHOW ALL REPLICAS STATUS -- From MariaDB 10.5.1\n\nDescription\n-----------\n\nThis statement is to be run on a replica and provides status information on\nessential parameters of the replica threads.\n\nThis statement requires the SUPER privilege, the REPLICATION_CLIENT privilege,\nor, from MariaDB 10.5.2, the REPLICATION SLAVE ADMIN privilege, or, from\nMariaDB 10.5.9, the REPLICA MONITOR privilege.\n\nMulti-Source\n------------\n\nThe ALL and \"connection_name\" options allow you to connect to many primaries\nat the same time.\n\nALL SLAVES (or ALL REPLICAS from MariaDB 10.5.1) gives you a list of all\nconnections to the primary nodes.\n\nThe rows will be sorted according to Connection_name.\n\nIf you specify a connection_name, you only get the information about that\nconnection. If connection_name is not used, then the name set by\ndefault_master_connection is used. If the connection name doesn\'t exist you\nwill get an error: There is no master connection for \'xxx\'.\n\nMariaDB starting with 10.7.0\n----------------------------\nThe FOR CHANNEL keyword was added for MySQL compatibility. This is identical\nto using the channel_name directly after SHOW SLAVE.\n\nColumn Descriptions\n-------------------\n\n+---------------------+------------------------------------------------------+\n| Name | Description |\n+---------------------+------------------------------------------------------+\n| Connection_name | Name of the primary connection. Returned with SHOW |\n| | ALL SLAVES STATUS (or SHOW ALL REPLICAS STATUS from |\n| | MariaDB 10.5.1) only. |\n+---------------------+------------------------------------------------------+\n| Slave_SQL_State | State of SQL thread. Returned with SHOW ALL SLAVES |\n| | STATUS (or SHOW ALL REPLICAS STATUS from MariaDB |\n| | 10.5.1) only. See Slave SQL Thread States. |\n+---------------------+------------------------------------------------------+\n| Slave_IO_State | State of I/O thread. See Slave I/O Thread States. |\n+---------------------+------------------------------------------------------+\n| Master_host | Master host that the replica is connected to. |\n+---------------------+------------------------------------------------------+\n| Master_user | Account user name being used to connect to the |\n| | primary. |\n+---------------------+------------------------------------------------------+\n| Master_port | The port being used to connect to the primary. |\n+---------------------+------------------------------------------------------+\n| Connect_Retry | Time in seconds between retries to connect. The |\n| | default is 60. The CHANGE MASTER TO statement can |\n| | set this. The master-retry-count option determines |\n| | the maximum number of reconnection attempts. |\n+---------------------+------------------------------------------------------+\n| Master_Log_File | Name of the primary binary log file that the I/O |\n| | thread is currently reading from. |\n+---------------------+------------------------------------------------------+\n| Read_Master_Log_Pos | Position up to which the I/O thread has read in the |\n| | current primary binary log file. |\n+---------------------+------------------------------------------------------+\n| Relay_Log_File | Name of the relay log file that the SQL thread is |\n| | currently processing. |\n+---------------------+------------------------------------------------------+\n| Relay_Log_Pos | Position up to which the SQL thread has finished |\n| | processing in the current relay log file. |\n+---------------------+------------------------------------------------------+\n| Relay_Master_Log_Fi | Name of the primary binary log file that contains |\n| e | the most recent event executed by the SQL thread. |\n+---------------------+------------------------------------------------------+\n| Slave_IO_Running | Whether the replica I/O thread is running and |\n| | connected (Yes), running but not connected to a |\n| | primary (Connecting) or not running (No). |\n+---------------------+------------------------------------------------------+\n| Slave_SQL_Running | Whether or not the SQL thread is running. |\n+---------------------+------------------------------------------------------+\n| Replicate_Rewrite_D | Databases specified for replicating and rewriting |\n| | with the replicate_rewrite_db option. Added in |\n| | MariaDB 10.11 |\n+---------------------+------------------------------------------------------+\n| Replicate_Do_DB | Databases specified for replicating with the |\n| | replicate_do_db option. |\n+---------------------+------------------------------------------------------+\n| Replicate_Ignore_DB | Databases specified for ignoring with the |\n| | replicate_ignore_db option. |\n+---------------------+------------------------------------------------------+\n| Replicate_Do_Table | Tables specified for replicating with the |\n| | replicate_do_table option. |\n+---------------------+------------------------------------------------------+\n| Replicate_Ignore_Ta | Tables specified for ignoring with the |\n| le | replicate_ignore_table option. |\n+---------------------+------------------------------------------------------+\n| Replicate_Wild_Do_T | Tables specified for replicating with the |\n| ble | replicate_wild_do_table option. |\n+---------------------+------------------------------------------------------+\n| Replicate_Wild_Igno | Tables specified for ignoring with the |\n| e_Table | replicate_wild_ignore_table option. |\n+---------------------+------------------------------------------------------+\n| Last_Errno | Alias for Last_SQL_Errno (see below) |\n+---------------------+------------------------------------------------------+\n| Last Error | Alias for Last_SQL_Error (see below) |\n+---------------------+------------------------------------------------------+\n| Skip_Counter | Number of events that a replica skips from the |\n| | master, as recorded in the sql_slave_skip_counter |\n| | system variable. |\n+---------------------+------------------------------------------------------+\n| Exec_Master_Log_Pos | Position up to which the SQL thread has processed |\n| | in the current master binary log file. Can be used |\n| | to start a new replica from a current replica with |\n| | the CHANGE MASTER TO ... MASTER_LOG_POS option. |\n+---------------------+------------------------------------------------------+\n| Relay_Log_Space | Total size of all relay log files combined. |\n+---------------------+------------------------------------------------------+\n| Until_Condition | |\n+---------------------+------------------------------------------------------+\n| Until_Log_File | The MASTER_LOG_FILE value of the START SLAVE UNTIL |\n| | condition. |\n+---------------------+------------------------------------------------------+\n| Until_Log_Pos | The MASTER_LOG_POS value of the START SLAVE UNTIL |\n| | condition. |\n+---------------------+------------------------------------------------------+\n| Master_SSL_Allowed | Whether an SSL connection is permitted (Yes), not |\n| | permitted (No) or permitted but without the replica |\n| | having SSL support enabled (Ignored) |\n+---------------------+------------------------------------------------------+\n| Master_SSL_CA_File | The MASTER_SSL_CA option of the CHANGE MASTER TO |\n| | statement. |\n+---------------------+------------------------------------------------------+\n| Master_SSL_CA_Path | The MASTER_SSL_CAPATH option of the CHANGE MASTER |\n| | TO statement. |\n+---------------------+------------------------------------------------------+\n| Master_SSL_Cert | The MASTER_SSL_CERT option of the CHANGE MASTER TO |\n| | statement. |\n+---------------------+------------------------------------------------------+\n| Master_SSL_Cipher | The MASTER_SSL_CIPHER option of the CHANGE MASTER |\n| | TO statement. |\n+---------------------+------------------------------------------------------+\n| Master_SSL_Key | The MASTER_SSL_KEY option of the CHANGE MASTER TO |\n| | statement. |\n+---------------------+------------------------------------------------------+\n| Seconds_Behind_Mast | Difference between the timestamp logged on the |\n| r | master for the event that the replica is currently |\n| | processing, and the current timestamp on the |\n| | replica. Zero if the replica is not currently |\n| | processing an event. With serial replication, |\n| | seconds_behind_master is updated when the SQL |\n| | thread begins executing a transaction. With |\n| | parallel replication, seconds_behind_master is |\n| | updated only after transactions commit. Starting in |\n| | MariaDB 10.3.38, 10.4.28, 10.5.19, 10.6.12, 10.8.7, |\n| | 10.9.5, 10.10.3, and 10.11.2, an exception is drawn |\n| | on the parallel replica to additionally update |\n| | seconds_behind_master when the first transaction |\n| | received after idling is queued to a worker for |\n| | execution, to provide a reliable initial value for |\n| | the duration until a transaction commits. |\n| | Additional behaviors to be aware of are as follows: |\n| | 1) Seconds_Behind_Master will update for ignored |\n| | events, e.g. those skipped due to |\n| | sql_slave_skip_counter. 2) On the serial replica, |\n| | transactions with prior timestamps can update |\n| | Seconds_Behind_Master such that it can go |\n| | backwards, though this is not true for the parallel |\n| | replica. 3) When configured with MASTER_DELAY, as a |\n| | replicated transaction begins executing (i.e. on a |\n| | serial or post-idle parallel replica), |\n| | Seconds_Behind_Master will update before delaying, |\n| | and while delaying occurs will grow to encompass |\n| | the configured value. 4) There is a known issue, |\n| | tracked by MDEV-17516, such that |\n| | Seconds_Behind_Master will initially present as 0 |\n| | on replica restart until a replicated transaction |\n| | begins executing, even if the last replica session |\n| | was lagging behind when stopped. |\n+---------------------+------------------------------------------------------+\n| Master_SSL_Verify_S | The MASTER_SSL_VERIFY_SERVER_CERT option of the |\n| rver_Cert | CHANGE MASTER TO statement. |\n+---------------------+------------------------------------------------------+\n| Last_IO_Errno | Error code of the most recent error that caused the |\n| | I/O thread to stop (also recorded in the replica\'s |\n| | error log). 0 means no error. RESET SLAVE or RESET |\n| | MASTER will reset this value. |\n+---------------------+------------------------------------------------------+\n| Last_IO_Error | Error message of the most recent error that caused |\n| | the I/O thread to stop (also recorded in the |\n| | replica\'s error log). An empty string means no |\n| | error. RESET SLAVE or RESET MASTER will reset this |\n| | value. |\n+---------------------+------------------------------------------------------+\n| Last_SQL_Errno | Error code of the most recent error that caused the |\n| | SQL thread to stop (also recorded in the replica\'s |\n| | error log). 0 means no error. RESET SLAVE or RESET |\n| | MASTER will reset this value. |\n+---------------------+------------------------------------------------------+','','https://mariadb.com/kb/en/show-replica-status/'); +update help_topic set description = CONCAT(description, '\n| Last_SQL_Error | Error message of the most recent error that caused |\n| | the SQL thread to stop (also recorded in the |\n| | replica\'s error log). An empty string means no |\n| | error. RESET SLAVE or RESET MASTER will reset this |\n| | value. |\n+---------------------+------------------------------------------------------+\n| Replicate_Ignore_Se | List of server_ids that are currently being ignored |\n| ver_Ids | for replication purposes, or an empty string for |\n| | none, as specified in the IGNORE_SERVER_IDS option |\n| | of the CHANGE MASTER TO statement. |\n+---------------------+------------------------------------------------------+\n| Master_Server_Id | The master\'s server_id value. |\n+---------------------+------------------------------------------------------+\n| Master_SSL_Crl | The MASTER_SSL_CRL option of the CHANGE MASTER TO |\n| | statement. |\n+---------------------+------------------------------------------------------+\n| Master_SSL_Crlpath | The MASTER_SSL_CRLPATH option of the CHANGE MASTER |\n| | TO statement. |\n+---------------------+------------------------------------------------------+\n| Using_Gtid | Whether or not global transaction ID\'s are being |\n| | used for replication (can be No, Slave_Pos, or |\n| | Current_Pos). |\n+---------------------+------------------------------------------------------+\n| Gtid_IO_Pos | Current global transaction ID value. |\n+---------------------+------------------------------------------------------+\n| Retried_transaction | Number of retried transactions for this connection. |\n| | Returned with SHOW ALL SLAVES STATUS only. |\n+---------------------+------------------------------------------------------+\n| Max_relay_log_size | Max relay log size for this connection. Returned |\n| | with SHOW ALL SLAVES STATUS only. |\n+---------------------+------------------------------------------------------+\n| Executed_log_entrie | How many log entries the replica has executed. |\n| | Returned with SHOW ALL SLAVES STATUS only. |\n+---------------------+------------------------------------------------------+\n| Slave_received_hear | How many heartbeats we have got from the master. |\n| beats | Returned with SHOW ALL SLAVES STATUS only. |\n+---------------------+------------------------------------------------------+\n| Slave_heartbeat_per | How often to request a heartbeat packet from the |\n| od | master (in seconds). Returned with SHOW ALL SLAVES |\n| | STATUS only. |\n+---------------------+------------------------------------------------------+\n| Gtid_Slave_Pos | GTID of the last event group replicated on a |\n| | replica server, for each replication domain, as |\n| | stored in the gtid_slave_pos system variable. |\n| | Returned with SHOW ALL SLAVES STATUS only. |\n+---------------------+------------------------------------------------------+\n| SQL_Delay | Value specified by MASTER_DELAY in CHANGE MASTER |\n| | (or 0 if none). |\n+---------------------+------------------------------------------------------+\n| SQL_Remaining_Delay | When the replica is delaying the execution of an |\n| | event due to MASTER_DELAY, this is the number of |\n| | seconds of delay remaining before the event will be |\n| | applied. Otherwise, the value is NULL. |\n+---------------------+------------------------------------------------------+\n| Slave_SQL_Running_S | The state of the SQL driver threads, same as in |\n| ate | SHOW PROCESSLIST. When the replica is delaying the |\n| | execution of an event due to MASTER_DELAY, this |\n| | field displays: \"Waiting until MASTER_DELAY seconds |\n| | after master executed event\". |\n+---------------------+------------------------------------------------------+\n| Slave_DDL_Groups | This status variable counts the occurrence of DDL |\n| | statements. This is a replica-side counter for |\n| | optimistic parallel replication. |\n+---------------------+------------------------------------------------------+\n| Slave_Non_Transacti | This status variable counts the occurrence of |\n| nal_Groups | non-transactional event groups. This is a |\n| | replica-side counter for optimistic parallel |\n| | replication. |\n+---------------------+------------------------------------------------------+\n| Slave_Transactional | This status variable counts the occurrence of |\n| Groups | transactional event groups. This is a replica-side |\n| | counter for optimistic parallel replication. |\n+---------------------+------------------------------------------------------+\n\nSHOW REPLICA STATUS\n-------------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSHOW REPLICA STATUS is an alias for SHOW SLAVE STATUS from MariaDB 10.5.1.\n\nExamples\n--------\n\nIf you issue this statement using the mariadb client, you can use a \\G\nstatement terminator rather than a semicolon to obtain a more readable\nvertical layout.\n\nSHOW SLAVE STATUS\\G\n*************************** 1. row ***************************\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\nSHOW ALL SLAVES STATUS\\G\n*************************** 1. row ***************************\n Connection_name:\n Slave_SQL_State: Slave has read all relay log; waiting for the\nslave 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 status 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\nURL: https://mariadb.com/kb/en/show-replica-status/') WHERE help_topic_id = 349; insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (350,26,'SHOW MASTER STATUS','Syntax\n------\n\nSHOW MASTER STATUS\nSHOW BINLOG STATUS -- From MariaDB 10.5.2\n\nDescription\n-----------\n\nProvides status information about the binary log files of the primary.\n\nThis statement requires the SUPER privilege, the REPLICATION_CLIENT privilege,\nor, from MariaDB 10.5.2, the BINLOG MONITOR privilege.\n\nTo see information about the current GTIDs in the binary log, use the\ngtid_binlog_pos variable.\n\nSHOW MASTER STATUS was renamed to SHOW BINLOG STATUS in MariaDB 10.5.2, but\nthe old name remains an alias for compatibility purposes.\n\nExample\n-------\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\nURL: https://mariadb.com/kb/en/show-binlog-status/','','https://mariadb.com/kb/en/show-binlog-status/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (351,26,'SHOW SLAVE HOSTS','Syntax\n------\n\nSHOW SLAVE HOSTS\nSHOW REPLICA HOSTS -- from MariaDB 10.5.1\n\nDescription\n-----------\n\nThis command is run on the primary and displays a list of replicas that are\ncurrently registered with it. Only replicas started with the\n--report-host=host_name option are visible in this list.\n\nThe output looks 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+------------+-----------+------+-----------+\n\n* Server_id: The unique server ID of the replica server, as configured in the\nserver\'s option file, or on the command line with --server-id=value.\n* Host: The host name of the replica server, as configured in the server\'s\noption file, or on the command line with --report-host=host_name. Note that\nthis can differ from the machine name as configured in the operating system.\n* Port: The port the replica server is listening on.\n* Master_id: The unique server ID of the primary server that the replica\nserver is replicating from.\n\nSome MariaDB and MySQL versions report another variable, rpl_recovery_rank.\nThis variable was never used, and was eventually removed in MariaDB 10.1.2 .\n\nRequires the REPLICATION MASTER ADMIN privilege (>= MariaDB 10.5.2) or the\nREPLICATION SLAVE privilege (<= MariaDB 10.5.1).\n\nSHOW REPLICA HOSTS\n------------------\n\nMariaDB starting with 10.5.1\n----------------------------\nSHOW REPLICA HOSTS is an alias for SHOW SLAVE HOSTS from MariaDB 10.5.1.\n\nURL: https://mariadb.com/kb/en/show-replica-hosts/','','https://mariadb.com/kb/en/show-replica-hosts/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (352,26,'SHOW PLUGINS','Syntax\n------\n\nSHOW PLUGINS;\n\nDescription\n-----------\n\nSHOW PLUGINS displays information about installed plugins. The Library column\nindicates the plugin library - if it is NULL, the plugin is built-in and\ncannot be uninstalled.\n\nThe PLUGINS table in the information_schema database contains more detailed\ninformation.\n\nFor specific information about storage engines (a particular type of plugin),\nsee the information_schema.ENGINES table and the SHOW ENGINES statement.\n\nExamples\n--------\n\nSHOW PLUGINS;\n+----------------------------+----------+--------------------+-------------+---\n-----+\n| Name | Status | Type | Library |\nLicense |\n+----------------------------+----------+--------------------+-------------+---\n-----+\n| binlog | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| mysql_native_password | ACTIVE | AUTHENTICATION | NULL |\nGPL |\n| mysql_old_password | ACTIVE | AUTHENTICATION | NULL |\nGPL |\n| MRG_MyISAM | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| MyISAM | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| CSV | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| MEMORY | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| FEDERATED | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| Aria | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| InnoDB | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL |\nGPL |\n...\n| INNODB_SYS_FOREIGN | ACTIVE | INFORMATION SCHEMA | NULL |\nGPL |\n| INNODB_SYS_FOREIGN_COLS | ACTIVE | INFORMATION SCHEMA | NULL |\nGPL |\n| SPHINX | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| FEEDBACK | DISABLED | INFORMATION SCHEMA | NULL |\nGPL |\n| partition | ACTIVE | STORAGE ENGINE | NULL |\nGPL |\n| pam | ACTIVE | AUTHENTICATION | auth_pam.so |\nGPL |\n+----------------------------+----------+--------------------+-------------+---\n-----+\n\nURL: https://mariadb.com/kb/en/show-plugins/','','https://mariadb.com/kb/en/show-plugins/'); @@ -466,10 +466,10 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (371,26,'SHOW CREATE PACKAGE','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nSHOW CREATE PACKAGE [ db_name . ] package_name\n\nDescription\n-----------\n\nThe SHOW CREATE PACKAGE statement can be used when Oracle SQL_MODE is set.\n\nShows the CREATE statement that creates the given package specification.\n\nExamples\n--------\n\nSHOW CREATE PACKAGE employee_tools\\G\n*************************** 1. row ***************************\n Package: employee_tools\n sql_mode:\nPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS\nNO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package: CREATE DEFINER=\"root\"@\"localhost\" PACKAGE\n\"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\nURL: https://mariadb.com/kb/en/show-create-package/','','https://mariadb.com/kb/en/show-create-package/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (372,26,'SHOW CREATE PACKAGE BODY','MariaDB starting with 10.3.5\n----------------------------\nOracle-style packages were introduced in MariaDB 10.3.5.\n\nSyntax\n------\n\nSHOW CREATE PACKAGE BODY [ db_name . ] package_name\n\nDescription\n-----------\n\nThe SHOW CREATE PACKAGE BODY statement can be used when Oracle SQL_MODE is set.\n\nShows the CREATE statement that creates the given package body (i.e. the\nimplementation).\n\nExamples\n--------\n\nSHOW CREATE PACKAGE BODY employee_tools\\G\n*************************** 1. row ***************************\n Package body: employee_tools\n sql_mode:\nPIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS\nNO_FIELD_OPTIONS,NO_AUTO_CREATE_USER\n Create Package Body: CREATE DEFINER=\"root\"@\"localhost\" PACKAGE BODY\n\"employee_tools\" AS\n\nstdRaiseAmount DECIMAL(10,2):=500;\n\nPROCEDURE log (eid INT, ecmnt TEXT) AS\n BEGIN\n INSERT INTO employee_log (id, cmnt) VALUES (eid, ecmnt);\n END;\n\nPROCEDURE hire(ename TEXT, esalary DECIMAL(10,2)) AS\n eid INT;\n BEGIN\n INSERT INTO employee (name, salary) VALUES (ename, esalary);\n eid:= last_insert_id();\n log(eid, \'hire \' || ename);\n END;\n\nFUNCTION 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=\' || nSalary);\n RETURN nSalary;\n END;\n\nPROCEDURE 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=\' || amount);\n END;\n\nPROCEDURE 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() || \' \' || current_user || \' started\');\nEND\ncharacter_set_client: utf8\ncollation_connection: utf8_general_ci\n Database Collation: latin1_swedish_ci\n\nURL: https://mariadb.com/kb/en/show-create-package-body/','','https://mariadb.com/kb/en/show-create-package-body/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (373,26,'SHOW CREATE PROCEDURE','Syntax\n------\n\nSHOW CREATE PROCEDURE proc_name\n\nDescription\n-----------\n\nThis statement is a MariaDB extension. It returns the exact string that can be\nused to re-create the named stored procedure, as well as the SQL_MODE that was\nused when the trigger has been created and the character set used by the\nconnection.. A similar statement, SHOW CREATE FUNCTION, displays information\nabout stored functions.\n\nBoth statements require that you are the owner of the routine or have the\nSELECT privilege on the mysql.proc table. When neither is true, the statements\ndisplay NULL for the Create Procedure or Create Function field.\n\nWarning Users with SELECT privileges on mysql.proc or USAGE privileges on *.*\ncan view the text of routines, even when they do not have privileges for the\nfunction or procedure itself.\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--------\n\nHere\'s a comparison of the SHOW CREATE PROCEDURE and SHOW CREATE FUNCTION\nstatements.\n\nSHOW CREATE PROCEDURE test.simpleproc\\G\n*************************** 1. row ***************************\n Procedure: simpleproc\n sql_mode:\n Create Procedure: CREATE PROCEDURE `simpleproc`(OUT param1 INT)\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 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 on the routine,\nattempting to CALL the procedure raises Error 1370.\n\nCALL test.prc1();\nError 1370 (42000): execute command denieed to user \'test_user\'@\'localhost\'\nfor routine \'test\'.\'prc1\'\n\nIf the user neither has privilege to the routine nor the SELECT privilege on\nmysql.proc table, it raises Error 1305, informing them that the procedure does\nnot exist.\n\nSHOW CREATE TABLES test.prc1\\G\nError 1305 (42000): PROCEDURE prc1 does not exist\n\nURL: https://mariadb.com/kb/en/show-create-procedure/','','https://mariadb.com/kb/en/show-create-procedure/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (374,26,'SHOW CREATE SEQUENCE','MariaDB starting with 10.3.1\n----------------------------\nSequences were introduced in MariaDB 10.3.\n\nSyntax\n------\n\nSHOW CREATE SEQUENCE sequence_name;\n\nDescription\n-----------\n\nShows the CREATE SEQUENCE statement that created the given sequence. The\nstatement requires the SELECT privilege for the table.\n\nExample\n-------\n\nCREATE SEQUENCE s1 START WITH 50;\nSHOW CREATE SEQUENCE s1\\G;\n*************************** 1. row ***************************\n Table: s1\nCreate Table: CREATE SEQUENCE `s1` start with 50 minvalue 1 maxvalue\n9223372036854775806 \n increment by 1 cache 1000 nocycle ENGINE=InnoDB\n\nNotes\n-----\n\nIf you want to see the underlying table structure used for the SEQUENCE you\ncan use SHOW CREATE TABLE on the SEQUENCE. You can also use SELECT to read the\ncurrent recorded state of the SEQUENCE:\n\nSHOW CREATE TABLE s1\\G\n*************************** 1. row ***************************\n Table: s1\nCreate Table: CREATE TABLE `s1` (\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 when sequences is\ncreated \n or value if RESTART is used\',\n `increment` bigint(21) NOT NULL COMMENT \'increment value\',\n `cache_size` bigint(21) unsigned NOT NULL,\n `cycle_option` tinyint(1) unsigned NOT NULL COMMENT \'0 if no cycles are\nallowed, \n 1 if the sequence should begin a new cycle when maximum_value is passed\',\n `cycle_count` bigint(21) NOT NULL COMMENT \'How many cycles have been done\'\n) ENGINE=InnoDB SEQUENCE=1\n\nSELECT * FROM s1\\G\n*************************** 1. row ***************************\nnext_not_cached_value: 50\n minimum_value: 1\n maximum_value: 9223372036854775806\n start_value: 50\n increment: 1\n cache_size: 1000\n cycle_option: 0\n cycle_count: 0\n\nURL: https://mariadb.com/kb/en/show-create-sequence/','','https://mariadb.com/kb/en/show-create-sequence/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (375,26,'SHOW CREATE TRIGGER','Syntax\n------\n\nSHOW CREATE TRIGGER trigger_name\n\nDescription\n-----------\n\nThis statement shows a CREATE TRIGGER statement that creates the given\ntrigger, as well as the SQL_MODE that was used when the trigger has been\ncreated and the 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--------\n\nSHOW CREATE TRIGGER example\\G\n*************************** 1. row ***************************\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\n\nENGINE_SUBSTITUTION\nSQL Original Statement: CREATE DEFINER=`root`@`localhost` TRIGGER example\nBEFORE\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\nMariaDB starting with 10.2.3\n----------------------------\nThe Created column was added in MySQL 5.7 and MariaDB 10.2.3 as part of\nintroducing multiple trigger events per action.\n\nURL: https://mariadb.com/kb/en/show-create-trigger/','','https://mariadb.com/kb/en/show-create-trigger/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (374,26,'SHOW CREATE SEQUENCE','Syntax\n------\n\nSHOW CREATE SEQUENCE sequence_name;\n\nDescription\n-----------\n\nShows the CREATE SEQUENCE statement that created the given sequence. The\nstatement requires the SELECT privilege for the table.\n\nExample\n-------\n\nCREATE SEQUENCE s1 START WITH 50;\nSHOW CREATE SEQUENCE s1\\G;\n*************************** 1. row ***************************\n Table: s1\nCreate Table: CREATE SEQUENCE `s1` start with 50 minvalue 1 maxvalue\n9223372036854775806 \n increment by 1 cache 1000 nocycle ENGINE=InnoDB\n\nNotes\n-----\n\nIf you want to see the underlying table structure used for the SEQUENCE you\ncan use SHOW CREATE TABLE on the SEQUENCE. You can also use SELECT to read the\ncurrent recorded state of the SEQUENCE:\n\nSHOW CREATE TABLE s1\\G\n*************************** 1. row ***************************\n Table: s1\nCreate Table: CREATE TABLE `s1` (\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 when sequences is\ncreated \n or value if RESTART is used\',\n `increment` bigint(21) NOT NULL COMMENT \'increment value\',\n `cache_size` bigint(21) unsigned NOT NULL,\n `cycle_option` tinyint(1) unsigned NOT NULL COMMENT \'0 if no cycles are\nallowed, \n 1 if the sequence should begin a new cycle when maximum_value is passed\',\n `cycle_count` bigint(21) NOT NULL COMMENT \'How many cycles have been done\'\n) ENGINE=InnoDB SEQUENCE=1\n\nSELECT * FROM s1\\G\n*************************** 1. row ***************************\nnext_not_cached_value: 50\n minimum_value: 1\n maximum_value: 9223372036854775806\n start_value: 50\n increment: 1\n cache_size: 1000\n cycle_option: 0\n cycle_count: 0\n\nURL: https://mariadb.com/kb/en/show-create-sequence/','','https://mariadb.com/kb/en/show-create-sequence/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (375,26,'SHOW CREATE TRIGGER','Syntax\n------\n\nSHOW CREATE TRIGGER trigger_name\n\nDescription\n-----------\n\nThis statement shows a CREATE TRIGGER statement that creates the given\ntrigger, as well as the SQL_MODE that was used when the trigger has been\ncreated and the character set used by the connection.\n\nThe TRIGGER privilege is required on the table the trigger is defined for to\nexecute this statement.\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--------\n\nSHOW CREATE TRIGGER example\\G\n*************************** 1. row ***************************\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\n\nENGINE_SUBSTITUTION\nSQL Original Statement: CREATE DEFINER=`root`@`localhost` TRIGGER example\nBEFORE\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\nMariaDB starting with 10.2.3\n----------------------------\nThe Created column was added in MySQL 5.7 and MariaDB 10.2.3 as part of\nintroducing multiple trigger events per action.\n\nURL: https://mariadb.com/kb/en/show-create-trigger/','','https://mariadb.com/kb/en/show-create-trigger/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (376,26,'SHOW CREATE VIEW','Syntax\n------\n\nSHOW CREATE VIEW view_name\n\nDescription\n-----------\n\nThis statement shows a CREATE VIEW statement that creates the given view, as\nwell as the character set used by the connection when the view was created.\nThis statement also works with views.\n\nSHOW CREATE VIEW quotes table, column and stored function names according to\nthe value of the sql_quote_show_create server system variable.\n\nExamples\n--------\n\nSHOW CREATE VIEW example\\G\n*************************** 1. row ***************************\n View: example\n Create View: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL\nSECURITY DEFINER VIEW `example` AS (select `t`.`id` AS `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 View: example\n Create View: CREATE ALGORITHM=UNDEFINED DEFINER=root@localhost SQL\nSECU\nRITY DEFINER VIEW example AS (select t.id AS id,t.s AS s from t)\ncharacter_set_client: cp850\ncollation_connection: cp850_general_ci\n\nGrants\n------\n\nTo be able to see a view, you need to have the SHOW VIEW and the SELECT\nprivilege on the view:\n\nGRANT SHOW VIEW,SELECT ON test_database.test_view TO \'test\'@\'localhost\';\n\nURL: https://mariadb.com/kb/en/show-create-view/','','https://mariadb.com/kb/en/show-create-view/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (377,26,'SHOW DATABASES','Syntax\n------\n\nSHOW {DATABASES | SCHEMAS}\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW DATABASES lists the databases on the MariaDB server host. SHOW SCHEMAS is\na synonym for SHOW DATABASES. The LIKE clause, if present on its own,\nindicates which database names to match. The WHERE and LIKE clauses can be\ngiven to select rows using more general conditions, as discussed in Extended\nSHOW.\n\nYou see only those databases for which you have some kind of privilege, unless\nyou have the global SHOW DATABASES privilege. You can also get this list using\nthe mysqlshow command.\n\nIf the server was started with the --skip-show-database option, you cannot use\nthis statement at all unless you have the SHOW DATABASES privilege.\n\nThe list of results returned by SHOW DATABASES is based on directories in the\ndata directory, which is how MariaDB implements databases. It\'s possible that\noutput includes directories that do not correspond to actual databases.\n\nThe Information Schema SCHEMATA table also contains database information.\n\nExamples\n--------\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\nURL: https://mariadb.com/kb/en/show-databases/','','https://mariadb.com/kb/en/show-databases/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (377,26,'SHOW DATABASES','Syntax\n------\n\nSHOW {DATABASES | SCHEMAS}\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW DATABASES lists the databases on the MariaDB server host. SHOW SCHEMAS is\na synonym for SHOW DATABASES. The LIKE clause, if present on its own,\nindicates which database names to match. The WHERE and LIKE clauses can be\ngiven to select rows using more general conditions, as discussed in Extended\nSHOW.\n\nYou see only those databases for which you have some kind of privilege, unless\nyou have the global SHOW DATABASES privilege. You can also get this list using\nthe mariadb-show command.\n\nIf the server was started with the --skip-show-database option, you cannot use\nthis statement at all unless you have the SHOW DATABASES privilege.\n\nThe list of results returned by SHOW DATABASES is based on directories in the\ndata directory, which is how MariaDB implements databases. It\'s possible that\noutput includes directories that do not correspond to actual databases.\n\nThe Information Schema SCHEMATA table also contains database information.\n\nExamples\n--------\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\nURL: https://mariadb.com/kb/en/show-databases/','','https://mariadb.com/kb/en/show-databases/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (378,26,'SHOW ENGINE','Syntax\n------\n\nSHOW ENGINE engine_name {STATUS | MUTEX}\n\nDescription\n-----------\n\nSHOW ENGINE displays operational information about a storage engine. The\nfollowing statements currently are supported:\n\nSHOW ENGINE INNODB STATUS\nSHOW ENGINE INNODB MUTEX\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\nSHOW ENGINE ROCKSDB STATUS\n\nIf the Sphinx Storage Engine is installed, the following is also supported:\n\nSHOW ENGINE SPHINX STATUS\n\nSee SHOW ENGINE SPHINX STATUS.\n\nOlder (and now removed) synonyms were SHOW INNODB STATUS for SHOW ENGINE\nINNODB STATUS and SHOW MUTEX STATUS for SHOW ENGINE INNODB MUTEX.\n\nSHOW ENGINE INNODB STATUS\n-------------------------\n\nSHOW ENGINE INNODB STATUS displays extensive information from the standard\nInnoDB Monitor about the state of the InnoDB storage engine. See SHOW ENGINE\nINNODB STATUS for more.\n\nSHOW ENGINE INNODB MUTEX\n------------------------\n\nSHOW ENGINE INNODB MUTEX displays InnoDB mutex statistics.\n\nThe statement displays the following output fields:\n\n* Type: Always InnoDB.\n* Name: The source file where the mutex is implemented, and the line number\n in the file where the mutex is created. The line number is dependent on the\nMariaDB version.\n* Status: This field displays the following values if UNIV_DEBUG was defined\nat compilation time (for example, in include/univ.h in the InnoDB part of the\nsource tree). Only the os_waits value is displayed if UNIV_DEBUG was not\ndefined. Without UNIV_DEBUG, the information on which the output is based is\ninsufficient to distinguish regular mutexes and mutexes that protect\n rw-locks (which allow multiple readers or a single writer). Consequently, the\n output may appear to contain multiple rows for the same mutex.\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. (spin_rounds divided by\n spin_waits provides the average round count.)\nos_waits indicates the number of operating system waits. This occurs when\n the spinlock did not work (the mutex was not locked during the spinlock and\n it was necessary to yield to the operating system and wait).\nos_yields indicates the number of times a the thread trying to lock a mutex\n gave up its timeslice and yielded to the operating system (on the\n presumption that allowing other threads to run will free the mutex so that\n it can be locked).\nos_wait_times indicates the amount of time (in ms) spent in operating system\n waits, if the timed_mutexes system variable is 1 (ON). If timed_mutexes is 0\n (OFF), timing is disabled, so os_wait_times is 0. timed_mutexes is off by\n default.\n\nInformation from this statement can be used to diagnose system problems. For\nexample, large values of spin_waits and spin_rounds may indicate scalability\nproblems.\n\nThe information_schema.INNODB_MUTEXES table provides similar information.\n\nSHOW ENGINE PERFORMANCE_SCHEMA STATUS\n-------------------------------------\n\nThis statement shows how much memory is used for performance_schema tables and\ninternal buffers.\n\nThe output contains the following fields:\n\n* Type: Always performance_schema.\n* Name: The name of a table, the name of an internal buffer, or the\nperformance_schema word, followed by a dot and an attribute. Internal buffers\nnames are enclosed by parenthesis. performance_schema means that the attribute\nrefers to the whole database (it is a total). \n* Status: The value for the attribute.\n\nThe following attributes are shown, in this order, for all tables:\n\n* row_size: The memory used for an individual record. This value will never\nchange.\n* row_count: The number of rows in the table or buffer. For some tables, this\nvalue depends on a server system variable.\n* memory: For tables and performance_schema, this is the result of row_size *\nrow_count.\n\nFor internal buffers, the attributes are:\n\n* count\n* size\n\nSHOW ENGINE ROCKSDB STATUS\n--------------------------\n\nSee also MyRocks Performance Troubleshooting\n\nURL: https://mariadb.com/kb/en/show-engine/','','https://mariadb.com/kb/en/show-engine/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (379,26,'SHOW ENGINE INNODB STATUS','SHOW ENGINE INNODB STATUS is a specific form of the SHOW ENGINE statement that\ndisplays the InnoDB Monitor output, which is extensive InnoDB information\nwhich can be useful in diagnosing problems.\n\nThe following sections are displayed\n\n* Status: Shows the timestamp, monitor name and the number of seconds, or the\nelapsed time between the current time and the time the InnoDB Monitor output\nwas last displayed. The per-second averages are based upon this time.\n* BACKGROUND THREAD: srv_master_thread lines show work performed by the main\nbackground thread.\n* SEMAPHORES: Threads waiting for a semaphore and stats on how the number of\ntimes threads have needed a spin or a wait on a mutex or rw-lock semaphore. If\nthis number of threads is large, there may be I/O or contention issues.\nReducing the size of the innodb_thread_concurrency system variable may help if\ncontention is related to thread scheduling. Spin rounds per wait shows the\nnumber of spinlock rounds per OS wait for a mutex. \n* LATEST FOREIGN KEY ERROR: Only shown if there has been a foreign key\nconstraint error, it displays the failed statement and information about the\nconstraint and the related tables.\n* LATEST DETECTED DEADLOCK: Only shown if there has been a deadlock, it\ndisplays the transactions involved in the deadlock and the statements being\nexecuted, held and required locked and the transaction rolled back to.\n* TRANSACTIONS: The output of this section can help identify lock contention,\nas well as reasons for the deadlocks.\n* FILE I/O: InnoDB thread information as well as pending I/O operations and\nI/O performance statistics.\n* INSERT BUFFER AND ADAPTIVE HASH INDEX: InnoDB insert buffer (old name for\nthe change buffer) and adaptive hash index status information, including the\nnumber of each type of operation performed, and adaptive hash index\nperformance.\n* LOG: InnoDB log information, including current log sequence number, how far\nthe log has been flushed to disk, the position at which InnoDB last took a\ncheckpoint, pending writes and write performance statistics.\n* BUFFER POOL AND MEMORY: Information on buffer pool pages read and written,\nwhich allows you to see the number of data file I/O operations performed by\nyour queries. See InnoDB Buffer Pool for more. Similar information is also\navailable from the INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS table.\n* ROW OPERATIONS:Information about the main thread, including the number and\nperformance rate for each type of row operation.\n\nIf the innodb_status_output_locks system variable is set to 1, extended lock\ninformation will be displayed.\n\nExample output:\n\n=====================================\n2019-09-06 12:44:13 0x7f93cc236700 INNODB MONITOR OUTPUT\n=====================================\nPer second averages calculated from the last 4 seconds\n-----------------\nBACKGROUND THREAD\n-----------------\nsrv_master_thread loops: 2 srv_active, 0 srv_shutdown, 83698 srv_idle\nsrv_master_thread log flush and writes: 83682\n----------\nSEMAPHORES\n----------\nOS WAIT ARRAY INFO: reservation count 15\nOS WAIT ARRAY INFO: signal count 8\nRW-shared spins 0, rounds 20, OS waits 7\nRW-excl spins 0, rounds 0, OS waits 0\nRW-sx spins 0, rounds 0, OS waits 0\nSpin rounds per wait: 20.00 RW-shared, 0.00 RW-excl, 0.00 RW-sx\n------------\nTRANSACTIONS\n------------\nTrx id counter 236\nPurge done for trx\'s n:o < 236 undo n:o < 0 state: running\nHistory list length 22\nLIST OF TRANSACTIONS FOR EACH SESSION:\n---TRANSACTION 421747401994584, not started\n0 lock struct(s), heap size 1136, 0 row lock(s)\n---TRANSACTION 421747401990328, not started\n0 lock struct(s), heap size 1136, 0 row lock(s)\n--------\nFILE I/O\n--------\nI/O thread 0 state: waiting for completed aio requests (insert buffer thread)\nI/O thread 1 state: waiting for completed aio requests (log thread)\nI/O thread 2 state: waiting for completed aio requests (read thread)\nI/O thread 3 state: waiting for completed aio requests (read thread)\nI/O thread 4 state: waiting for completed aio requests (read thread)\nI/O thread 5 state: waiting for completed aio requests (read thread)\nI/O thread 6 state: waiting for completed aio requests (write thread)\nI/O thread 7 state: waiting for completed aio requests (write thread)\nI/O thread 8 state: waiting for completed aio requests (write thread)\nI/O thread 9 state: waiting for completed aio requests (write thread)\nPending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,\n ibuf aio reads:, log i/o\'s:, sync i/o\'s:\nPending flushes (fsync) log: 0; buffer pool: 0\n286 OS file reads, 171 OS file writes, 22 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\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\nHash table size 34679, node heap has 0 buffer(s)\n0.00 hash searches/s, 0.00 non-hash searches/s\n---\nLOG\n---\nLog sequence number 445926\nLog flushed up to 445926\nPages flushed up to 445926\nLast checkpoint at 445917\n0 pending log flushes, 0 pending chkp writes\n18 log i/o\'s done, 0.00 log i/o\'s/second\n----------------------\nBUFFER POOL AND MEMORY\n----------------------\nTotal large memory allocated 167772160\nDictionary memory allocated 50768\nBuffer pool size 8012\nFree buffers 7611\nDatabase pages 401\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 264, created 137, written 156\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, Random read ahead\n0.00/s\nLRU len: 401, 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\nProcess ID=4267, Main thread ID=140272021272320, state: sleeping\nNumber of rows inserted 1, updated 0, deleted 0, read 1\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 0\n0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s\n----------------------------\nEND OF INNODB MONITOR OUTPUT\n============================\n\nURL: https://mariadb.com/kb/en/show-engine-innodb-status/','','https://mariadb.com/kb/en/show-engine-innodb-status/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (380,26,'SHOW ENGINES','Syntax\n------\n\nSHOW [STORAGE] ENGINES\n\nDescription\n-----------\n\nSHOW ENGINES displays status information about the server\'s storage engines.\nThis is particularly useful for checking whether a storage engine is\nsupported, or to see what the default engine is. SHOW TABLE TYPES is a\ndeprecated synonym.\n\nThe information_schema.ENGINES table provides the same information.\n\nSince storage engines are plugins, different information about them is also\nshown in the information_schema.PLUGINS table and by the SHOW PLUGINS\nstatement.\n\nNote that both MySQL\'s InnoDB and Percona\'s XtraDB replacement are labeled as\nInnoDB. However, if XtraDB is in use, it will be specified in the COMMENT\nfield. See XtraDB and InnoDB. The same applies to FederatedX.\n\nThe output consists of the following columns:\n\n* Engine indicates the engine\'s name.\n* Support indicates whether the engine is installed, and whether it is the\ndefault engine for the current session.\n* Comment is a brief description.\n* Transactions, XA and Savepoints indicate whether transactions, XA\ntransactions and transaction savepoints are supported by the engine.\n\nExamples\n--------\n\nSHOW ENGINES\\G\n*************************** 1. row ***************************\n Engine: InnoDB\n Support: DEFAULT\n Comment: Supports transactions, row-level locking, and foreign keys\nTransactions: YES\n XA: YES\n Savepoints: YES\n*************************** 2. row ***************************\n Engine: CSV\n Support: YES\n Comment: CSV storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 3. row ***************************\n Engine: MyISAM\n Support: YES\n Comment: MyISAM storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 4. row ***************************\n Engine: BLACKHOLE\n Support: YES\n Comment: /dev/null storage engine (anything you write to it disappears)\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 5. row ***************************\n Engine: FEDERATED\n Support: YES\n Comment: FederatedX pluggable storage engine\nTransactions: YES\n XA: NO\n Savepoints: YES\n*************************** 6. row ***************************\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 Engine: ARCHIVE\n Support: YES\n Comment: Archive storage engine\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 8. row ***************************\n Engine: MEMORY\n Support: YES\n Comment: Hash based, stored in memory, useful for temporary tables\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 9. row ***************************\n Engine: PERFORMANCE_SCHEMA\n Support: YES\n Comment: Performance Schema\nTransactions: NO\n XA: NO\n Savepoints: NO\n*************************** 10. row ***************************\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\nURL: https://mariadb.com/kb/en/show-engines/','','https://mariadb.com/kb/en/show-engines/'); @@ -483,38 +483,35 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (388,26,'SHOW PRIVILEGES','Syntax\n------\n\nSHOW PRIVILEGES\n\nDescription\n-----------\n\nSHOW PRIVILEGES shows the list of system privileges that the MariaDB server\nsupports. The exact list of privileges depends on the version of your server.\n\nNote that before MariaDB 10.3.23, MariaDB 10.4.13 and MariaDB 10.5.2 , the\nDelete history privilege displays as Delete versioning rows (MDEV-20382).\n\nExample\n-------\n\nFrom MariaDB 10.5.9\n\nSHOW PRIVILEGES;\n+--------------------------+---------------------------------------+-----------\n--------------------------------------------------------+\n| Privilege | Context | Comment \n |\n+--------------------------+---------------------------------------+-----------\n--------------------------------------------------------+\n| Alter | Tables | To alter\nthe table |\n| Alter routine | Functions,Procedures | To alter\nor drop stored functions/procedures |\n| Create | Databases,Tables,Indexes | To create\nnew databases and tables |\n| Create routine | Databases | To use\nCREATE FUNCTION/PROCEDURE |\n| Create temporary tables | Databases | To use\nCREATE TEMPORARY TABLE |\n| Create view | Tables | To create\nnew views |\n| Create user | Server Admin | To create\nnew users |\n| Delete | Tables | To delete\nexisting rows |\n| Delete history | Tables | To delete\nversioning table historical rows |\n| Drop | Databases,Tables | To drop\ndatabases, tables, and views |\n| Event | Server Admin | To\ncreate, alter, drop and execute events |\n| Execute | Functions,Procedures | To\nexecute stored routines |\n| File | File access on server | To read\nand write files on the server |\n| Grant option | Databases,Tables,Functions,Procedures | To give\nto other users those privileges you possess |\n| Index | Tables | To create\nor drop indexes |\n| Insert | Tables | To insert\ndata into tables |\n| Lock tables | Databases | To use\nLOCK TABLES (together with SELECT privilege) |\n| Process | Server Admin | To view\nthe plain text of currently executing queries |\n| Proxy | Server Admin | To make\nproxy user possible |\n| References | Databases,Tables | To have\nreferences on tables |\n| Reload | Server Admin | To reload\nor refresh tables, logs and privileges |\n| Binlog admin | Server | To purge\nbinary logs |\n| Binlog monitor | Server | To use\nSHOW BINLOG STATUS and SHOW BINARY LOG |\n| Binlog replay | Server | To use\nBINLOG (generated by mariadb-binlog) |\n| Replication master admin | Server | To\nmonitor connected slaves |\n| Replication slave admin | Server | To\nstart/stop slave and apply binlog events |\n| Slave monitor | Server | To use\nSHOW SLAVE STATUS and SHOW RELAYLOG EVENTS |\n| Replication slave | Server Admin | To read\nbinary log events from the master |\n| Select | Tables | To\nretrieve rows from table |\n| Show databases | Server Admin | To see\nall databases with SHOW DATABASES |\n| Show view | Tables | To see\nviews with SHOW CREATE VIEW |\n| Shutdown | Server Admin | To shut\ndown the server |\n| Super | Server Admin | To use\nKILL thread, SET GLOBAL, CHANGE MASTER, etc. |\n| Trigger | Tables | To use\ntriggers |\n| Create tablespace | Server Admin | To\ncreate/alter/drop tablespaces |\n| Update | Tables | To update\nexisting rows |\n| Set user | Server | To create\nviews and stored routines with a different definer |\n| Federated admin | Server | To\nexecute the CREATE SERVER, ALTER SERVER, DROP SERVER statements |\n| Connection admin | Server | To bypass\nconnection limits and kill other users\' connections |\n| Read_only admin | Server | To\nperform write operations even if @@read_only=ON |\n| Usage | Server Admin | No\nprivileges - allow connect only |\n+--------------------------+---------------------------------------+-----------\n--------------------------------------------------------+\n41 rows in set (0.000 sec)\n\nURL: https://mariadb.com/kb/en/show-privileges/','','https://mariadb.com/kb/en/show-privileges/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (389,26,'SHOW PROCEDURE CODE','Syntax\n------\n\nSHOW PROCEDURE CODE proc_name\n\nDescription\n-----------\n\nThis statement is a MariaDB extension that is available only for servers that\nhave been built with debugging support. It displays a representation of the\ninternal implementation of the named stored procedure. A similar statement,\nSHOW FUNCTION CODE, displays information about stored functions.\n\nBoth statements require that you be the owner of the routine or have SELECT\naccess to the mysql.proc table.\n\nIf the named routine is available, each statement produces a result set. Each\nrow in the result set corresponds to one \"instruction\" in the routine. The\nfirst column is Pos, which is an ordinal number beginning with 0. The second\ncolumn is Instruction, which contains an SQL statement (usually changed from\nthe original source), or a directive which has meaning only to the\nstored-routine handler.\n\nExamples\n--------\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\nURL: https://mariadb.com/kb/en/show-procedure-code/','','https://mariadb.com/kb/en/show-procedure-code/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (390,26,'SHOW PROCEDURE STATUS','Syntax\n------\n\nSHOW PROCEDURE STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThis statement is a MariaDB extension. It returns characteristics of a stored\nprocedure, such as the database, name, type, creator, creation and\nmodification dates, and character set information. A similar statement, SHOW\nFUNCTION STATUS, displays information about stored functions.\n\nThe LIKE clause, if present, indicates which procedure or function names to\nmatch. The WHERE and LIKE clauses can be given to select rows using more\ngeneral conditions, as discussed in Extended SHOW.\n\nThe ROUTINES table in the INFORMATION_SCHEMA database contains more detailed\ninformation.\n\nExamples\n--------\n\nSHOW PROCEDURE STATUS LIKE \'p1\'\\G\n*************************** 1. row ***************************\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\nURL: https://mariadb.com/kb/en/show-procedure-status/','','https://mariadb.com/kb/en/show-procedure-status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (391,26,'SHOW PROCESSLIST','Syntax\n------\n\nSHOW [FULL] PROCESSLIST\n\nDescription\n-----------\n\nSHOW PROCESSLIST shows you which threads are running. You can also get this\ninformation from the information_schema.PROCESSLIST table or the mysqladmin\nprocesslist command. 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). If you do not use the\nFULL keyword, only the first 100 characters of each statement are shown in the\nInfo field.\n\nThe columns shown in SHOW PROCESSLIST are:\n\n+---------------------+------------------------------------------------------+\n| Name | Description |\n+---------------------+------------------------------------------------------+\n| ID | The client\'s process ID. |\n+---------------------+------------------------------------------------------+\n| USER | The username associated with the process. |\n+---------------------+------------------------------------------------------+\n| HOST | The host the client is connected to. |\n+---------------------+------------------------------------------------------+\n| DB | The default database of the process (NULL if no |\n| | default). |\n+---------------------+------------------------------------------------------+\n| COMMAND | The command type. See Thread Command Values. |\n+---------------------+------------------------------------------------------+\n| TIME | The amount of time, in seconds, the process has |\n| | been in its current state. For a replica SQL thread |\n| | before MariaDB 10.1, this is the time in seconds |\n| | between the last replicated event\'s timestamp and |\n| | the replica machine\'s real time. |\n+---------------------+------------------------------------------------------+\n| STATE | See Thread States. |\n+---------------------+------------------------------------------------------+\n| INFO | The statement being executed. |\n+---------------------+------------------------------------------------------+\n| PROGRESS | The total progress of the process (0-100%) (see |\n| | Progress Reporting). |\n+---------------------+------------------------------------------------------+\n\nSee TIME_MS column in information_schema.PROCESSLIST for differences in the\nTIME column between MariaDB and MySQL.\n\nThe information_schema.PROCESSLIST table contains the following additional\ncolumns:\n\n+---------------------+------------------------------------------------------+\n| Name | Description |\n+---------------------+------------------------------------------------------+\n| TIME_MS | The amount of time, in milliseconds, the process |\n| | has been in its current state. |\n+---------------------+------------------------------------------------------+\n| STAGE | The stage the process is currently in. |\n+---------------------+------------------------------------------------------+\n| MAX_STAGE | The maximum number of stages. |\n+---------------------+------------------------------------------------------+\n| PROGRESS | The progress of the process within the current |\n| | stage (0-100%). |\n+---------------------+------------------------------------------------------+\n| MEMORY_USED | The amount of memory used by the process. |\n+---------------------+------------------------------------------------------+\n| EXAMINED_ROWS | The number of rows the process has examined. |\n+---------------------+------------------------------------------------------+\n| QUERY_ID | Query ID. |\n+---------------------+------------------------------------------------------+\n\nNote that the PROGRESS field from the information schema, and the PROGRESS\nfield from SHOW PROCESSLIST display different results. SHOW PROCESSLIST shows\nthe total progress, while the information schema shows the progress for the\ncurrent stage only.\n\nThreads can be killed using their thread_id or their query_id, with the KILL\nstatement.\n\nSince queries on this table are locking, if the performance_schema is enabled,\nyou may want to query the THREADS table instead.\n\nExamples\n--------\n\nSHOW PROCESSLIST;\n+----+-----------------+-----------+------+---------+------+-------------------\n----+------------------+----------+\n| Id | User | Host | db | Command | Time | State \n | Info | Progress |\n+----+-----------------+-----------+------+---------+------+-------------------\n----+------------------+----------+\n| 2 | event_scheduler | localhost | NULL | Daemon | 2693 | Waiting on empty\nqueue | NULL | 0.000 |\n| 4 | root | localhost | NULL | Query | 0 | Table lock \n | SHOW PROCESSLIST | 0.000 |\n+----+-----------------+-----------+------+---------+------+-------------------\n----+------------------+----------+\n\nURL: https://mariadb.com/kb/en/show-processlist/','','https://mariadb.com/kb/en/show-processlist/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (391,26,'SHOW PROCESSLIST','Syntax\n------\n\nSHOW [FULL] PROCESSLIST\n\nDescription\n-----------\n\nSHOW PROCESSLIST shows you which threads are running. You can also get this\ninformation from the information_schema.PROCESSLIST table or the mariadb-admin\nprocesslist command. 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). If you do not use the\nFULL keyword, only the first 100 characters of each statement are shown in the\nInfo field.\n\nThe columns shown in SHOW PROCESSLIST are:\n\n+---------------------+------------------------------------------------------+\n| Name | Description |\n+---------------------+------------------------------------------------------+\n| ID | The client\'s process ID. |\n+---------------------+------------------------------------------------------+\n| USER | The username associated with the process. |\n+---------------------+------------------------------------------------------+\n| HOST | The host the client is connected to. |\n+---------------------+------------------------------------------------------+\n| DB | The default database of the process (NULL if no |\n| | default). |\n+---------------------+------------------------------------------------------+\n| COMMAND | The command type. See Thread Command Values. |\n+---------------------+------------------------------------------------------+\n| TIME | The amount of time, in seconds, the process has |\n| | been in its current state. For a replica SQL thread |\n| | before MariaDB 10.1, this is the time in seconds |\n| | between the last replicated event\'s timestamp and |\n| | the replica machine\'s real time. |\n+---------------------+------------------------------------------------------+\n| STATE | See Thread States. |\n+---------------------+------------------------------------------------------+\n| INFO | The statement being executed. |\n+---------------------+------------------------------------------------------+\n| PROGRESS | The total progress of the process (0-100%) (see |\n| | Progress Reporting). |\n+---------------------+------------------------------------------------------+\n\nSee TIME_MS column in information_schema.PROCESSLIST for differences in the\nTIME column between MariaDB and MySQL.\n\nThe information_schema.PROCESSLIST table contains the following additional\ncolumns:\n\n+---------------------+------------------------------------------------------+\n| Name | Description |\n+---------------------+------------------------------------------------------+\n| TIME_MS | The amount of time, in milliseconds, the process |\n| | has been in its current state. |\n+---------------------+------------------------------------------------------+\n| STAGE | The stage the process is currently in. |\n+---------------------+------------------------------------------------------+\n| MAX_STAGE | The maximum number of stages. |\n+---------------------+------------------------------------------------------+\n| PROGRESS | The progress of the process within the current |\n| | stage (0-100%). |\n+---------------------+------------------------------------------------------+\n| MEMORY_USED | The amount of memory used by the process. |\n+---------------------+------------------------------------------------------+\n| EXAMINED_ROWS | The number of rows the process has examined. |\n+---------------------+------------------------------------------------------+\n| QUERY_ID | Query ID. |\n+---------------------+------------------------------------------------------+\n\nNote that the PROGRESS field from the information schema, and the PROGRESS\nfield from SHOW PROCESSLIST display different results. SHOW PROCESSLIST shows\nthe total progress, while the information schema shows the progress for the\ncurrent stage only.\n\nThreads can be killed using their thread_id or their query_id, with the KILL\nstatement.\n\nSince queries on this table are locking, if the performance_schema is enabled,\nyou may want to query the THREADS table instead.\n\nExamples\n--------\n\nSHOW PROCESSLIST;\n+----+-----------------+-----------+------+---------+------+-------------------\n----+------------------+----------+\n| Id | User | Host | db | Command | Time | State \n | Info | Progress |\n+----+-----------------+-----------+------+---------+------+-------------------\n----+------------------+----------+\n| 2 | event_scheduler | localhost | NULL | Daemon | 2693 | Waiting on empty\nqueue | NULL | 0.000 |\n| 4 | root | localhost | NULL | Query | 0 | Table lock \n | SHOW PROCESSLIST | 0.000 |\n+----+-----------------+-----------+------+---------+------+-------------------\n----+------------------+----------+\n\nURL: https://mariadb.com/kb/en/show-processlist/','','https://mariadb.com/kb/en/show-processlist/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (392,26,'SHOW PROFILE','Syntax\n------\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-----------\n\nThe SHOW PROFILE and SHOW PROFILES statements display profiling information\nthat indicates resource usage for statements executed during the course of the\ncurrent session.\n\nProfiling is controlled by the profiling session variable, which has a default\nvalue of 0 (OFF). Profiling is enabled by setting profiling to 1 or ON:\n\nSET profiling = 1;\n\nSHOW PROFILES displays a list of the most recent statements sent to the\nmaster. The size of the list is controlled by the profiling_history_size\nsession variable, which has a default value of 15. The maximum value is 100.\nSetting the value to 0 has the practical effect of disabling profiling.\n\nAll statements are profiled except SHOW PROFILES and SHOW PROFILE, so you will\nfind neither of those statements in the profile list. Malformed statements are\nprofiled. For example, SHOW PROFILING is an illegal statement, and a syntax\nerror occurs if you try to execute it, but it will show up in the profiling\nlist.\n\nSHOW PROFILE displays detailed information about a single statement. Without\nthe FOR QUERY n clause, the output pertains to the most recently executed\nstatement. If FOR QUERY n is included, SHOW PROFILE displays information for\nstatement n. The values of n correspond to the Query_ID values displayed by\nSHOW PROFILES.\n\nThe LIMIT row_count clause may be given to limit the output to row_count rows.\nIf LIMIT is given, OFFSET offset may be added to begin the output offset rows\ninto the full set of rows.\n\nBy default, SHOW PROFILE displays Status and Duration columns. The Status\nvalues are like the State values displayed by SHOW PROCESSLIST, although there\nmight be some minor differences in interpretation for the two statements for\nsome 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 additional types of\ninformation:\n\n* ALL displays all information\n* BLOCK IO displays counts for block input and output operations\n* CONTEXT SWITCHES displays counts for voluntary and involuntary context\nswitches\n* CPU displays user and system CPU usage times\n* IPC displays counts for messages sent and received\n* MEMORY is not currently implemented\n* PAGE FAULTS displays counts for major and minor page faults\n* SOURCE displays the names of functions from the source code, together with\nthe name and line number of the file in which the function occurs\n* SWAPS displays swap counts\n\nProfiling is enabled per session. When a session ends, its profiling\ninformation is lost.\n\nThe information_schema.PROFILING table contains similar information.\n\nExamples\n--------\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\nURL: https://mariadb.com/kb/en/show-profile/','','https://mariadb.com/kb/en/show-profile/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (393,26,'SHOW PROFILES','Syntax\n------\n\nSHOW PROFILES\n\nDescription\n-----------\n\nThe SHOW PROFILES statement displays profiling information that indicates\nresource usage for statements executed during the course of the current\nsession. It is used together with SHOW PROFILE.\n\nURL: https://mariadb.com/kb/en/show-profiles/','','https://mariadb.com/kb/en/show-profiles/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (394,26,'SHOW QUERY_RESPONSE_TIME','It is possible to use SHOW QUERY_RESPONSE_TIME as an alternative for\nretrieving information from the QUERY_RESPONSE_TIME plugin.\n\nThis was introduced as part of the Information Schema plugin extension.\n\nURL: https://mariadb.com/kb/en/show-query_response_time/','','https://mariadb.com/kb/en/show-query_response_time/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (395,26,'SHOW STATUS','Syntax\n------\n\nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW STATUS provides server status information. This information also can be\nobtained using the mysqladmin extended-status command, or by querying the\nInformation Schema GLOBAL_STATUS and SESSION_STATUS tables. The LIKE clause,\nif present, indicates which variable names to match. The WHERE clause can be\ngiven to select rows using more general conditions.\n\nWith the GLOBAL modifier, SHOW STATUS displays the status values for all\nconnections to MariaDB. With SESSION, it displays the status values for the\ncurrent connection. If no modifier is present, the default is SESSION. LOCAL\nis a synonym for SESSION. If you see a lot of 0 values, the reason is probably\nthat you have used SHOW STATUS with a new connection instead of SHOW GLOBAL\nSTATUS.\n\nSome status variables have only a global value. For these, you get the same\nvalue for both GLOBAL and SESSION.\n\nSee Server Status Variables for a full list, scope and description of the\nvariables that can be viewed with SHOW STATUS.\n\nThe LIKE clause, if present on its own, indicates which variable name to match.\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nExamples\n--------\n\nFull output from MariaDB 10.1.17:\n\nSHOW GLOBAL STATUS;\n+--------------------------------------------------------------+---------------\n------------------------+\n| Variable_name | Value \n |\n+--------------------------------------------------------------+---------------\n------------------------+\n| Aborted_clients | 0 \n |\n| Aborted_connects | 0 \n |\n| Access_denied_errors | 0 \n |\n| Acl_column_grants | 0 \n |\n| Acl_database_grants | 2 \n |\n| Acl_function_grants | 0 \n |\n| Acl_procedure_grants | 0 \n |\n| Acl_proxy_users | 2 \n |\n| Acl_role_grants | 0 \n |\n| Acl_roles | 0 \n |\n| Acl_table_grants | 0 \n |\n| Acl_users | 6 \n |\n| Aria_pagecache_blocks_not_flushed | 0 \n |\n| Aria_pagecache_blocks_unused | 15706 \n |\n| Aria_pagecache_blocks_used | 0 \n |\n| Aria_pagecache_read_requests | 0 \n |\n| Aria_pagecache_reads | 0 \n |\n| Aria_pagecache_write_requests | 0 \n |\n| Aria_pagecache_writes | 0 \n |\n| Aria_transaction_log_syncs | 0 \n |\n| Binlog_commits | 0 \n |\n| Binlog_group_commits | 0 \n |\n| Binlog_group_commit_trigger_count | 0 \n |\n| Binlog_group_commit_trigger_lock_wait | 0 \n |\n| Binlog_group_commit_trigger_timeout | 0 \n |\n| Binlog_snapshot_file | \n |\n| Binlog_snapshot_position | 0 \n |\n| Binlog_bytes_written | 0 \n |\n| Binlog_cache_disk_use | 0 \n |\n| Binlog_cache_use | 0 \n |\n| Binlog_stmt_cache_disk_use | 0 \n |\n| Binlog_stmt_cache_use | 0 \n |\n| Busy_time | 0.000000 \n |\n| Bytes_received | 432 \n |\n| Bytes_sent | 15183 \n |\n| Com_admin_commands | 1 \n |\n| Com_alter_db | 0 \n |\n| Com_alter_db_upgrade | 0 \n |\n| Com_alter_event | 0 \n |\n| Com_alter_function | 0 \n |\n| Com_alter_procedure | 0 \n |\n| Com_alter_server | 0 \n |\n| Com_alter_table | 0 \n |\n| Com_alter_tablespace | 0 \n |\n| Com_analyze | 0 \n |\n| Com_assign_to_keycache | 0 \n |\n| Com_begin | 0 \n |\n| Com_binlog | 0 \n |\n| Com_call_procedure | 0 \n |\n| Com_change_db | 0 \n |\n| Com_change_master | 0 \n |\n| Com_check | 0 \n |\n| Com_checksum | 0 \n |\n| Com_commit | 0 \n |\n| Com_compound_sql | 0 \n |\n| Com_create_db | 0 \n |\n| Com_create_event | 0 \n |\n| Com_create_function | 0 \n |\n| Com_create_index | 0 \n |\n| Com_create_procedure | 0 \n |\n| Com_create_role | 0 \n |\n| Com_create_server | 0 \n |\n| Com_create_table | 0 \n |\n| Com_create_temporary_table | 0 \n |\n| Com_create_trigger | 0 \n |\n| Com_create_udf | 0 \n |\n| Com_create_user | 0 \n |\n| Com_create_view | 0 \n |\n| Com_dealloc_sql | 0 \n |\n| Com_delete | 0 \n |\n| Com_delete_multi | 0 \n |\n| Com_do | 0 \n |\n| Com_drop_db | 0 \n |\n| Com_drop_event | 0 \n |\n| Com_drop_function | 0 \n |\n| Com_drop_index | 0 \n |\n| Com_drop_procedure | 0 \n |\n| Com_drop_role | 0 \n |\n| Com_drop_server | 0 \n |\n| Com_drop_table | 0 \n |\n| Com_drop_temporary_table | 0 \n |\n| Com_drop_trigger | 0 \n |\n| Com_drop_user | 0 \n |\n| Com_drop_view | 0 \n |\n| Com_empty_query | 0 \n |\n| Com_execute_sql | 0 \n |\n| Com_flush | 0 \n |\n| Com_get_diagnostics | 0 \n |\n| Com_grant | 0 \n |\n| Com_grant_role | 0 \n |\n| Com_ha_close | 0 \n |\n| Com_ha_open | 0 \n |\n| Com_ha_read | 0 \n |\n| Com_help | 0 \n |\n| Com_insert | 0 \n |\n| Com_insert_select | 0 \n |\n| Com_install_plugin | 0 \n |\n| Com_kill | 0 \n |\n| Com_load | 0 \n |\n| Com_lock_tables | 0 \n |\n| Com_optimize | 0 \n |\n| Com_preload_keys | 0 \n |\n| Com_prepare_sql | 0 \n |\n| Com_purge | 0 \n |\n| Com_purge_before_date | 0 \n |\n| Com_release_savepoint | 0 \n |\n| Com_rename_table | 0 \n |\n| Com_rename_user | 0 \n |\n| Com_repair | 0 \n |\n| Com_replace | 0 \n |\n| Com_replace_select | 0 \n |\n| Com_reset | 0 \n |\n| Com_resignal | 0 \n |\n| Com_revoke | 0 \n |\n| Com_revoke_all | 0 \n |\n| Com_revoke_role | 0 \n |\n| Com_rollback | 0 \n |\n| Com_rollback_to_savepoint | 0 \n |\n| Com_savepoint | 0 \n |\n| Com_select | 1 \n |\n| Com_set_option | 0 \n |\n| Com_show_authors | 0 \n |\n| Com_show_binlog_events | 0 \n |\n| Com_show_binlogs | 0 \n |\n| Com_show_charsets | 0 \n |\n| Com_show_collations | 0 \n |\n| Com_show_contributors | 0 \n |\n| Com_show_create_db | 0 \n |\n| Com_show_create_event | 0 \n |\n| Com_show_create_func | 0 \n |\n| Com_show_create_proc | 0 \n |\n| Com_show_create_table | 0 \n |\n| Com_show_create_trigger | 0 \n |\n| Com_show_databases | 0 \n |\n| Com_show_engine_logs | 0 \n |','','https://mariadb.com/kb/en/show-status/'); -update help_topic set description = CONCAT(description, '\n| Com_show_engine_mutex | 0 \n |\n| Com_show_engine_status | 0 \n |\n| Com_show_errors | 0 \n |\n| Com_show_events | 0 \n |\n| Com_show_explain | 0 \n |\n| Com_show_fields | 0 \n |\n| Com_show_function_status | 0 \n |\n| Com_show_generic | 0 \n |\n| Com_show_grants | 0 \n |\n| Com_show_keys | 0 \n |\n| Com_show_master_status | 0 \n |\n| Com_show_open_tables | 0 \n |\n| Com_show_plugins | 0 \n |\n| Com_show_privileges | 0 \n |\n| Com_show_procedure_status | 0 \n |\n| Com_show_processlist | 0 \n |\n| Com_show_profile | 0 \n |\n| Com_show_profiles | 0 \n |\n| Com_show_relaylog_events | 0 \n |\n| Com_show_slave_hosts | 0 \n |\n| Com_show_slave_status | 0 \n |\n| Com_show_status | 2 \n |\n| Com_show_storage_engines | 0 \n |\n| Com_show_table_status | 0 \n |\n| Com_show_tables | 0 \n |\n| Com_show_triggers | 0 \n |\n| Com_show_variables | 0 \n |\n| Com_show_warnings | 0 \n |\n| Com_shutdown | 0 \n |\n| Com_signal | 0 \n |\n| Com_start_all_slaves | 0 \n |\n| Com_start_slave | 0 \n |\n| Com_stmt_close | 0 \n |\n| Com_stmt_execute | 0 \n |\n| Com_stmt_fetch | 0 \n |\n| Com_stmt_prepare | 0 \n |\n| Com_stmt_reprepare | 0 \n |\n| Com_stmt_reset | 0 \n |\n| Com_stmt_send_long_data | 0 \n |\n| Com_stop_all_slaves | 0 \n |\n| Com_stop_slave | 0 \n |\n| Com_truncate | 0 \n |\n| Com_uninstall_plugin | 0 \n |\n| Com_unlock_tables | 0 \n |\n| Com_update | 0 \n |\n| Com_update_multi | 0 \n |\n| Com_xa_commit | 0 \n |\n| Com_xa_end | 0 \n |\n| Com_xa_prepare | 0 \n |\n| Com_xa_recover | 0 \n |\n| Com_xa_rollback | 0 \n |\n| Com_xa_start | 0 \n |\n| Compression | OFF \n |\n| Connection_errors_accept | 0 \n |\n| Connection_errors_internal | 0 \n |\n| Connection_errors_max_connections | 0 \n |\n| Connection_errors_peer_address | 0 \n |\n| Connection_errors_select | 0 \n |\n| Connection_errors_tcpwrap | 0 \n |\n| Connections | 4 \n |\n| Cpu_time | 0.000000 \n |\n| Created_tmp_disk_tables | 0 \n |\n| Created_tmp_files | 6 \n |\n| Created_tmp_tables | 2 \n |\n| Delayed_errors | 0 \n |\n| Delayed_insert_threads | 0 \n |\n| Delayed_writes | 0 \n |\n| Delete_scan | 0 \n |\n| Empty_queries | 0 \n |\n| Executed_events | 0 \n |\n| Executed_triggers | 0 \n |\n| Feature_delay_key_write | 0 \n |\n| Feature_dynamic_columns | 0 \n |\n| Feature_fulltext | 0 \n |\n| Feature_gis | 0 \n |\n| Feature_locale | 0 \n |\n| Feature_subquery | 0 \n |\n| Feature_timezone | 0 \n |\n| Feature_trigger | 0 \n |\n| Feature_xml | 0 \n |\n| Flush_commands | 1 \n |\n| Handler_commit | 1 \n |\n| Handler_delete | 0 \n |\n| Handler_discover | 0 \n |\n| Handler_external_lock | 0 \n |\n| Handler_icp_attempts | 0 \n |\n| Handler_icp_match | 0 \n |\n| Handler_mrr_init | 0 \n |\n| Handler_mrr_key_refills | 0 \n |\n| Handler_mrr_rowid_refills | 0 \n |\n| Handler_prepare | 0 \n |\n| Handler_read_first | 3 \n |\n| Handler_read_key | 0 \n |\n| Handler_read_last | 0 \n |\n| Handler_read_next | 0 \n |\n| Handler_read_prev | 0 \n |\n| Handler_read_retry | 0 \n |\n| Handler_read_rnd | 0 \n |\n| Handler_read_rnd_deleted | 0 \n |\n| Handler_read_rnd_next | 537 \n |\n| Handler_rollback | 0 \n |\n| Handler_savepoint | 0 \n |\n| Handler_savepoint_rollback | 0 \n |\n| Handler_tmp_update | 0 \n |\n| Handler_tmp_write | 516 \n |\n| Handler_update | 0 \n |\n| Handler_write | 0 \n |\n| Innodb_available_undo_logs | 128 \n |\n| Innodb_background_log_sync | 222 \n |\n| Innodb_buffer_pool_bytes_data | 2523136 \n |\n| Innodb_buffer_pool_bytes_dirty | 0 \n |\n| Innodb_buffer_pool_dump_status | Dumping\nbuffer pool(s) not yet started |\n| Innodb_buffer_pool_load_status | Loading\nbuffer pool(s) not yet started |\n| Innodb_buffer_pool_pages_data | 154 \n |\n| Innodb_buffer_pool_pages_dirty | 0 \n |\n| Innodb_buffer_pool_pages_flushed | 1 \n |\n| Innodb_buffer_pool_pages_free | 8037 \n |\n| Innodb_buffer_pool_pages_lru_flushed | 0 \n |\n| Innodb_buffer_pool_pages_made_not_young | 0 \n |\n| Innodb_buffer_pool_pages_made_young | 0 \n |\n| Innodb_buffer_pool_pages_misc | 0 \n |\n| Innodb_buffer_pool_pages_old | 0 \n |\n| Innodb_buffer_pool_pages_total | 8191 \n |\n| Innodb_buffer_pool_read_ahead | 0 \n |\n| Innodb_buffer_pool_read_ahead_evicted | 0 \n |\n| Innodb_buffer_pool_read_ahead_rnd | 0 \n |\n| Innodb_buffer_pool_read_requests | 558 \n |\n| Innodb_buffer_pool_reads | 155 \n |\n| Innodb_buffer_pool_wait_free | 0 \n |\n| Innodb_buffer_pool_write_requests | 1 \n |\n| Innodb_checkpoint_age | 0 \n |\n| Innodb_checkpoint_max_age | 80826164 \n |\n| Innodb_data_fsyncs | 5 \n |\n| Innodb_data_pending_fsyncs | 0 \n |\n| Innodb_data_pending_reads | 0 \n |\n| Innodb_data_pending_writes | 0 \n |\n| Innodb_data_read | 2609664 \n |\n| Innodb_data_reads | 172 \n |\n| Innodb_data_writes | 5 \n |\n| Innodb_data_written | 34304 \n |\n| Innodb_dblwr_pages_written | 1 \n |\n| Innodb_dblwr_writes | 1 \n |\n| Innodb_deadlocks | 0 \n |\n| Innodb_have_atomic_builtins | ON \n |\n| Innodb_history_list_length | 0 \n |\n| Innodb_ibuf_discarded_delete_marks | 0 \n |\n| Innodb_ibuf_discarded_deletes | 0 \n |\n| Innodb_ibuf_discarded_inserts | 0 \n |\n| Innodb_ibuf_free_list | 0 \n |\n| Innodb_ibuf_merged_delete_marks | 0 \n |\n| Innodb_ibuf_merged_deletes | 0 \n |\n| Innodb_ibuf_merged_inserts | 0 \n |\n| Innodb_ibuf_merges | 0 \n |') WHERE help_topic_id = 395; -update help_topic set description = CONCAT(description, '\n| Innodb_ibuf_segment_size | 2 \n |\n| Innodb_ibuf_size | 1 \n |\n| Innodb_log_waits | 0 \n |\n| Innodb_log_write_requests | 0 \n |\n| Innodb_log_writes | 1 \n |\n| Innodb_lsn_current | 1616829 \n |\n| Innodb_lsn_flushed | 1616829 \n |\n| Innodb_lsn_last_checkpoint | 1616829 \n |\n| Innodb_master_thread_active_loops | 0 \n |\n| Innodb_master_thread_idle_loops | 222 \n |\n| Innodb_max_trx_id | 2308 \n |\n| Innodb_mem_adaptive_hash | 2217568 \n |\n| Innodb_mem_dictionary | 630703 \n |\n| Innodb_mem_total | 140771328 \n |\n| Innodb_mutex_os_waits | 1 \n |\n| Innodb_mutex_spin_rounds | 30 \n |\n| Innodb_mutex_spin_waits | 1 \n |\n| Innodb_oldest_view_low_limit_trx_id | 0 \n |\n| Innodb_os_log_fsyncs | 3 \n |\n| Innodb_os_log_pending_fsyncs | 0 \n |\n| Innodb_os_log_pending_writes | 0 \n |\n| Innodb_os_log_written | 512 \n |\n| Innodb_page_size | 16384 \n |\n| Innodb_pages_created | 0 \n |\n| Innodb_pages_read | 154 \n |\n| Innodb_pages_written | 1 \n |\n| Innodb_purge_trx_id | 0 \n |\n| Innodb_purge_undo_no | 0 \n |\n| Innodb_read_views_memory | 88 \n |\n| Innodb_row_lock_current_waits | 0 \n |\n| Innodb_row_lock_time | 0 \n |\n| Innodb_row_lock_time_avg | 0 \n |\n| Innodb_row_lock_time_max | 0 \n |\n| Innodb_row_lock_waits | 0 \n |\n| Innodb_rows_deleted | 0 \n |\n| Innodb_rows_inserted | 0 \n |\n| Innodb_rows_read | 0 \n |\n| Innodb_rows_updated | 0 \n |\n| Innodb_system_rows_deleted | 0 \n |\n| Innodb_system_rows_inserted | 0 \n |\n| Innodb_system_rows_read | 0 \n |\n| Innodb_system_rows_updated | 0 \n |\n| Innodb_s_lock_os_waits | 2 \n |\n| Innodb_s_lock_spin_rounds | 60 \n |\n| Innodb_s_lock_spin_waits | 2 \n |\n| Innodb_truncated_status_writes | 0 \n |\n| Innodb_x_lock_os_waits | 0 \n |\n| Innodb_x_lock_spin_rounds | 0 \n |\n| Innodb_x_lock_spin_waits | 0 \n |\n| Innodb_page_compression_saved | 0 \n |\n| Innodb_page_compression_trim_sect512 | 0 \n |\n| Innodb_page_compression_trim_sect1024 | 0 \n |\n| Innodb_page_compression_trim_sect2048 | 0 \n |\n| Innodb_page_compression_trim_sect4096 | 0 \n |\n| Innodb_page_compression_trim_sect8192 | 0 \n |\n| Innodb_page_compression_trim_sect16384 | 0 \n |\n| Innodb_page_compression_trim_sect32768 | 0 \n |\n| Innodb_num_index_pages_written | 0 \n |\n| Innodb_num_non_index_pages_written | 5 \n |\n| Innodb_num_pages_page_compressed | 0 \n |\n| Innodb_num_page_compressed_trim_op | 0 \n |\n| Innodb_num_page_compressed_trim_op_saved | 0 \n |\n| Innodb_num_pages_page_decompressed | 0 \n |\n| Innodb_num_pages_page_compression_error | 0 \n |\n| Innodb_num_pages_encrypted | 0 \n |\n| Innodb_num_pages_decrypted | 0 \n |\n| Innodb_have_lz4 | OFF \n |\n| Innodb_have_lzo | OFF \n |\n| Innodb_have_lzma | OFF \n |\n| Innodb_have_bzip2 | OFF \n |\n| Innodb_have_snappy | OFF \n |\n| Innodb_defragment_compression_failures | 0 \n |\n| Innodb_defragment_failures | 0 \n |\n| Innodb_defragment_count | 0 \n |\n| Innodb_onlineddl_rowlog_rows | 0 \n |\n| Innodb_onlineddl_rowlog_pct_used | 0 \n |\n| Innodb_onlineddl_pct_progress | 0 \n |\n| Innodb_secondary_index_triggered_cluster_reads | 0 \n |\n| Innodb_secondary_index_triggered_cluster_reads_avoided | 0 \n |\n| Innodb_encryption_rotation_pages_read_from_cache | 0 \n |\n| Innodb_encryption_rotation_pages_read_from_disk | 0 \n |\n| Innodb_encryption_rotation_pages_modified | 0 \n |\n| Innodb_encryption_rotation_pages_flushed | 0 \n |\n| Innodb_encryption_rotation_estimated_iops | 0 \n |\n| Innodb_scrub_background_page_reorganizations | 0 \n |\n| Innodb_scrub_background_page_splits | 0 \n |\n| Innodb_scrub_background_page_split_failures_underflow | 0 \n |\n| Innodb_scrub_background_page_split_failures_out_of_filespace | 0 \n |\n| Innodb_scrub_background_page_split_failures_missing_index | 0 \n |\n| Innodb_scrub_background_page_split_failures_unknown | 0 \n |\n| Key_blocks_not_flushed | 0 \n |\n| Key_blocks_unused | 107163 \n |\n| Key_blocks_used | 0 \n |\n| Key_blocks_warm | 0 \n |\n| Key_read_requests | 0 \n |\n| Key_reads | 0 \n |\n| Key_write_requests | 0 \n |\n| Key_writes | 0 \n |\n| Last_query_cost | 0.000000 \n |\n| Master_gtid_wait_count | 0 \n |\n| Master_gtid_wait_time | 0 \n |\n| Master_gtid_wait_timeouts | 0 \n |\n| Max_statement_time_exceeded | 0 \n |\n| Max_used_connections | 1 \n |\n| Memory_used | 273614696 \n |\n| Not_flushed_delayed_rows | 0 \n |\n| Open_files | 25 \n |\n| Open_streams | 0 \n |\n| Open_table_definitions | 18 \n |\n| Open_tables | 11 \n |\n| Opened_files | 77 \n |\n| Opened_plugin_libraries | 0 \n |\n| Opened_table_definitions | 18 \n |\n| Opened_tables | 18 \n |\n| Opened_views | 0 \n |\n| Performance_schema_accounts_lost | 0 \n |\n| Performance_schema_cond_classes_lost | 0 \n |\n| Performance_schema_cond_instances_lost | 0 \n |\n| Performance_schema_digest_lost | 0 \n |\n| Performance_schema_file_classes_lost | 0 \n |\n| Performance_schema_file_handles_lost | 0 \n |\n| Performance_schema_file_instances_lost | 0 \n |\n| Performance_schema_hosts_lost | 0 \n |\n| Performance_schema_locker_lost | 0 \n |\n| Performance_schema_mutex_classes_lost | 0 \n |\n| Performance_schema_mutex_instances_lost | 0 \n |\n| Performance_schema_rwlock_classes_lost | 0 \n |\n| Performance_schema_rwlock_instances_lost | 0 \n |\n| Performance_schema_session_connect_attrs_lost | 0 \n |\n| Performance_schema_socket_classes_lost | 0 \n |\n| Performance_schema_socket_instances_lost | 0 \n |\n| Performance_schema_stage_classes_lost | 0 \n |\n| Performance_schema_statement_classes_lost | 0 \n |\n| Performance_schema_table_handles_lost | 0 \n |\n| Performance_schema_table_instances_lost | 0 \n |\n| Performance_schema_thread_classes_lost | 0 \n |\n| Performance_schema_thread_instances_lost | 0 \n |\n| Performance_schema_users_lost | 0 \n |\n| Prepared_stmt_count | 0 \n |\n| Qcache_free_blocks | 1 \n |\n| Qcache_free_memory | 1031336 \n |\n| Qcache_hits | 0 \n |\n| Qcache_inserts | 0 \n |\n| Qcache_lowmem_prunes | 0 \n |\n| Qcache_not_cached | 0 \n |\n| Qcache_queries_in_cache | 0 \n |\n| Qcache_total_blocks | 1 \n |\n| Queries | 4 \n |\n| Questions | 4 \n |\n| Rows_read | 10 \n |\n| Rows_sent | 517 \n |\n| Rows_tmp_read | 516 \n |\n| Rpl_status | AUTH_MASTER \n |') WHERE help_topic_id = 395; -update help_topic set description = CONCAT(description, '\n| Select_full_join | 0 \n |\n| Select_full_range_join | 0 \n |\n| Select_range | 0 \n |\n| Select_range_check | 0 \n |\n| Select_scan | 2 \n |\n| Slave_connections | 0 \n |\n| Slave_heartbeat_period | 0.000 \n |\n| Slave_open_temp_tables | 0 \n |\n| Slave_received_heartbeats | 0 \n |\n| Slave_retried_transactions | 0 \n |\n| Slave_running | OFF \n |\n| Slave_skipped_errors | 0 \n |\n| Slaves_connected | 0 \n |\n| Slaves_running | 0 \n |\n| Slow_launch_threads | 0 \n |\n| Slow_queries | 0 \n |\n| Sort_merge_passes | 0 \n |\n| Sort_priority_queue_sorts | 0 \n |\n| Sort_range | 0 \n |\n| Sort_rows | 0 \n |\n| Sort_scan | 0 \n |\n| Ssl_accept_renegotiates | 0 \n |\n| Ssl_accepts | 0 \n |\n| Ssl_callback_cache_hits | 0 \n |\n| Ssl_cipher | \n |\n| Ssl_cipher_list | \n |\n| Ssl_client_connects | 0 \n |\n| Ssl_connect_renegotiates | 0 \n |\n| Ssl_ctx_verify_depth | 0 \n |\n| Ssl_ctx_verify_mode | 0 \n |\n| Ssl_default_timeout | 0 \n |\n| Ssl_finished_accepts | 0 \n |\n| Ssl_finished_connects | 0 \n |\n| Ssl_server_not_after | \n |\n| Ssl_server_not_before | \n |\n| Ssl_session_cache_hits | 0 \n |\n| Ssl_session_cache_misses | 0 \n |\n| Ssl_session_cache_mode | NONE \n |\n| Ssl_session_cache_overflows | 0 \n |\n| Ssl_session_cache_size | 0 \n |\n| Ssl_session_cache_timeouts | 0 \n |\n| Ssl_sessions_reused | 0 \n |\n| Ssl_used_session_cache_entries | 0 \n |\n| Ssl_verify_depth | 0 \n |\n| Ssl_verify_mode | 0 \n |\n| Ssl_version | \n |\n| Subquery_cache_hit | 0 \n |\n| Subquery_cache_miss | 0 \n |\n| Syncs | 2 \n |\n| Table_locks_immediate | 21 \n |\n| Table_locks_waited | 0 \n |\n| Tc_log_max_pages_used | 0 \n |\n| Tc_log_page_size | 4096 \n |\n| Tc_log_page_waits | 0 \n |\n| Threadpool_idle_threads | 0 \n |\n| Threadpool_threads | 0 \n |\n| Threads_cached | 0 \n |\n| Threads_connected | 1 \n |\n| Threads_created | 2 \n |\n| Threads_running | 1 \n |\n| Update_scan | 0 \n |\n| Uptime | 223 \n |\n| Uptime_since_flush_status | 223 \n |\n| wsrep_cluster_conf_id |\n18446744073709551615 |\n| wsrep_cluster_size | 0 \n |\n| wsrep_cluster_state_uuid | \n |\n| wsrep_cluster_status | Disconnected \n |\n| wsrep_connected | OFF \n |\n| wsrep_local_bf_aborts | 0 \n |\n| wsrep_local_index |\n18446744073709551615 |\n| wsrep_provider_name | \n |\n| wsrep_provider_vendor | \n |\n| wsrep_provider_version | \n |\n| wsrep_ready | OFF \n |\n| wsrep_thread_count | 0 \n |\n+--------------------------------------------------------------+---------------\n------------------------+\n516 rows in set (0.00 sec)\n\nExample of filtered output:\n\nSHOW STATUS LIKE \'Key%\';\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\nURL: https://mariadb.com/kb/en/show-status/') WHERE help_topic_id = 395; -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (396,26,'SHOW TABLE STATUS','Syntax\n------\n\nSHOW TABLE STATUS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TABLE STATUS works like SHOW TABLES, but provides more extensive\ninformation about each non-TEMPORARY table.\n\nThe LIKE clause, if present on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe following information is returned:\n\n+---------------------------+------------------------------------------------+\n| Column | Description |\n+---------------------------+------------------------------------------------+\n| Name | Table name. |\n+---------------------------+------------------------------------------------+\n| Engine | Table storage engine. |\n+---------------------------+------------------------------------------------+\n| Version | Version number from the table\'s .frm file. |\n+---------------------------+------------------------------------------------+\n| Row_format | Row format (see InnoDB, Aria and MyISAM row |\n| | formats). |\n+---------------------------+------------------------------------------------+\n| Rows | Number of rows in the table. Some engines, |\n| | such as XtraDB and InnoDB may store an |\n| | estimate. |\n+---------------------------+------------------------------------------------+\n| Avg_row_length | Average row length in the table. |\n+---------------------------+------------------------------------------------+\n| Data_length | For InnoDB/XtraDB, the index size, in pages, |\n| | multiplied by the page size. For Aria and |\n| | MyISAM, length of the data file, in bytes. |\n| | For MEMORY, the approximate allocated memory. |\n+---------------------------+------------------------------------------------+\n| Max_data_length | Maximum length of the data file, ie the total |\n| | number of bytes that could be stored in the |\n| | table. Not used in XtraDB and InnoDB. |\n+---------------------------+------------------------------------------------+\n| Index_length | Length of the index file. |\n+---------------------------+------------------------------------------------+\n| Data_free | Bytes allocated but unused. For InnoDB tables |\n| | in a shared tablespace, the free space of the |\n| | shared tablespace with small safety margin. |\n| | An estimate in the case of partitioned tables |\n| | - see the PARTITIONS table. |\n+---------------------------+------------------------------------------------+\n| Auto_increment | Next AUTO_INCREMENT value. |\n+---------------------------+------------------------------------------------+\n| Create_time | Time the table was created. Some engines just |\n| | return the ctime information from the file |\n| | system layer here, in that case the value is |\n| | not necessarily the table creation time but |\n| | rather the time the file system metadata for |\n| | it had last changed. |\n+---------------------------+------------------------------------------------+\n| Update_time | Time the table was last updated. On Windows, |\n| | the timestamp is not updated on update, so |\n| | MyISAM values will be inaccurate. In InnoDB, |\n| | if shared tablespaces are used, will be NULL, |\n| | while buffering can also delay the update, so |\n| | the value will differ from the actual time of |\n| | the last UPDATE, INSERT or DELETE. |\n+---------------------------+------------------------------------------------+\n| Check_time | Time the table was last checked. Not kept by |\n| | all storage engines, in which case will be |\n| | NULL. |\n+---------------------------+------------------------------------------------+\n| Collation | Character set and collation. |\n+---------------------------+------------------------------------------------+\n| Checksum | Live checksum value, if any. |\n+---------------------------+------------------------------------------------+\n| Create_options | Extra CREATE TABLE options. |\n+---------------------------+------------------------------------------------+\n| Comment | Table comment provided when MariaDB created |\n| | the table. |\n+---------------------------+------------------------------------------------+\n| Max_index_length | Maximum index length (supported by MyISAM and |\n| | Aria tables). Added in MariaDB 10.3.5. |\n+---------------------------+------------------------------------------------+\n| Temporary | Placeholder to signal that a table is a |\n| | temporary table. Currently always \"N\", except |\n| | \"Y\" for generated information_schema tables |\n| | and NULL for views. Added in MariaDB 10.3.5. |\n+---------------------------+------------------------------------------------+\n\nSimilar information can be found in the information_schema.TABLES table as\nwell as by using mysqlshow:\n\nmysqlshow --status db_name\n\nViews\n-----\n\nFor views, all columns in SHOW TABLE STATUS are NULL except \'Name\' and\n\'Comment\'\n\nExample\n-------\n\nshow table status\\G\n*************************** 1. row ***************************\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\nURL: https://mariadb.com/kb/en/show-table-status/','','https://mariadb.com/kb/en/show-table-status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (397,26,'SHOW TABLES','Syntax\n------\n\nSHOW [FULL] TABLES [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TABLES lists the non-TEMPORARY tables, sequences and views in a given\ndatabase.\n\nThe LIKE clause, if present on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW. For example, when searching for\ntables in the test database, the column name for use in the WHERE and LIKE\nclauses will be Tables_in_test\n\nThe FULL modifier is supported such that SHOW FULL TABLES displays a second\noutput column. Values for the second column, Table_type, are BASE TABLE for a\ntable, VIEW for a view 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 not show up in the\noutput from SHOW TABLES or mysqlshow db_name.\n\nThe information_schema.TABLES table, as well as the SHOW TABLE STATUS\nstatement, provide extended information about tables.\n\nExamples\n--------\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\nURL: https://mariadb.com/kb/en/show-tables/','','https://mariadb.com/kb/en/show-tables/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (395,26,'SHOW STATUS','Syntax\n------\n\nSHOW [GLOBAL | SESSION] STATUS\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW STATUS provides server status information. This information also can be\nobtained using the mariadb-admin extended-status command, or by querying the\nInformation Schema GLOBAL_STATUS and SESSION_STATUS tables. The LIKE clause,\nif present, indicates which variable names to match. The WHERE clause can be\ngiven to select rows using more general conditions.\n\nWith the GLOBAL modifier, SHOW STATUS displays the status values for all\nconnections to MariaDB. With SESSION, it displays the status values for the\ncurrent connection. If no modifier is present, the default is SESSION. LOCAL\nis a synonym for SESSION. If you see a lot of 0 values, the reason is probably\nthat you have used SHOW STATUS with a new connection instead of SHOW GLOBAL\nSTATUS.\n\nSome status variables have only a global value. For these, you get the same\nvalue for both GLOBAL and SESSION.\n\nSee Server Status Variables for a full list, scope and description of the\nvariables that can be viewed with SHOW STATUS.\n\nThe LIKE clause, if present on its own, indicates which variable name to match.\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nExamples\n--------\n\nSHOW GLOBAL STATUS;\n+--------------------------------------------------------------+---------------\n------------------------+\n| Variable_name | Value \n |\n+--------------------------------------------------------------+---------------\n------------------------+\n| Aborted_clients | 0 \n |\n| Aborted_connects | 0 \n |\n| Access_denied_errors | 0 \n |\n| Acl_column_grants | 0 \n |\n| Acl_database_grants | 2 \n |\n| Acl_function_grants | 0 \n |\n| Acl_procedure_grants | 0 \n |\n| Acl_proxy_users | 2 \n |\n| Acl_role_grants | 0 \n |\n| Acl_roles | 0 \n |\n| Acl_table_grants | 0 \n |\n| Acl_users | 6 \n |\n| Aria_pagecache_blocks_not_flushed | 0 \n |\n| Aria_pagecache_blocks_unused | 15706 \n |\n...\n| wsrep_local_index |\n18446744073709551615 |\n| wsrep_provider_name | \n |\n| wsrep_provider_vendor | \n |\n| wsrep_provider_version | \n |\n| wsrep_ready | OFF \n |\n| wsrep_thread_count | 0 \n |\n+--------------------------------------------------------------+---------------\n------------------------+\n516 rows in set (0.00 sec)\n\nExample of filtered output:\n\nSHOW STATUS LIKE \'Key%\';\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\nURL: https://mariadb.com/kb/en/show-status/','','https://mariadb.com/kb/en/show-status/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (396,26,'SHOW TABLE STATUS','Syntax\n------\n\nSHOW TABLE STATUS [{FROM | IN} db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TABLE STATUS works like SHOW TABLES, but provides more extensive\ninformation about each table (until MariaDB 11.2.0, only non-TEMPORARY tables\nare shown).\n\nThe LIKE clause, if present on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe following information is returned:\n\n+---------------------------+------------------------------------------------+\n| Column | Description |\n+---------------------------+------------------------------------------------+\n| Name | Table name. |\n+---------------------------+------------------------------------------------+\n| Engine | Table storage engine. |\n+---------------------------+------------------------------------------------+\n| Version | Version number from the table\'s .frm file. |\n+---------------------------+------------------------------------------------+\n| Row_format | Row format (see InnoDB, Aria and MyISAM row |\n| | formats). |\n+---------------------------+------------------------------------------------+\n| Rows | Number of rows in the table. Some engines, |\n| | such as InnoDB may store an estimate. |\n+---------------------------+------------------------------------------------+\n| Avg_row_length | Average row length in the table. |\n+---------------------------+------------------------------------------------+\n| Data_length | For InnoDB, the index size, in pages, |\n| | multiplied by the page size. For Aria and |\n| | MyISAM, length of the data file, in bytes. |\n| | For MEMORY, the approximate allocated memory. |\n+---------------------------+------------------------------------------------+\n| Max_data_length | Maximum length of the data file, ie the total |\n| | number of bytes that could be stored in the |\n| | table. Not used in InnoDB. |\n+---------------------------+------------------------------------------------+\n| Index_length | Length of the index file. |\n+---------------------------+------------------------------------------------+\n| Data_free | Bytes allocated but unused. For InnoDB tables |\n| | in a shared tablespace, the free space of the |\n| | shared tablespace with small safety margin. |\n| | An estimate in the case of partitioned tables |\n| | - see the PARTITIONS table. |\n+---------------------------+------------------------------------------------+\n| Auto_increment | Next AUTO_INCREMENT value. |\n+---------------------------+------------------------------------------------+\n| Create_time | Time the table was created. Some engines just |\n| | return the ctime information from the file |\n| | system layer here, in that case the value is |\n| | not necessarily the table creation time but |\n| | rather the time the file system metadata for |\n| | it had last changed. |\n+---------------------------+------------------------------------------------+\n| Update_time | Time the table was last updated. On Windows, |\n| | the timestamp is not updated on update, so |\n| | MyISAM values will be inaccurate. In InnoDB, |\n| | if shared tablespaces are used, will be NULL, |\n| | while buffering can also delay the update, so |\n| | the value will differ from the actual time of |\n| | the last UPDATE, INSERT or DELETE. |\n+---------------------------+------------------------------------------------+\n| Check_time | Time the table was last checked. Not kept by |\n| | all storage engines, in which case will be |\n| | NULL. |\n+---------------------------+------------------------------------------------+\n| Collation | Character set and collation. |\n+---------------------------+------------------------------------------------+\n| Checksum | Live checksum value, if any. |\n+---------------------------+------------------------------------------------+\n| Create_options | Extra CREATE TABLE options. |\n+---------------------------+------------------------------------------------+\n| Comment | Table comment provided when MariaDB created |\n| | the table. |\n+---------------------------+------------------------------------------------+\n| Max_index_length | Maximum index length (supported by MyISAM and |\n| | Aria tables). |\n+---------------------------+------------------------------------------------+\n| Temporary | Until MariaDB 11.2.0, placeholder to signal |\n| | that a table is a temporary table and always |\n| | \"N\", except \"Y\" for generated |\n| | information_schema tables and NULL for views. |\n| | From MariaDB 11.2.0, will also be set to \"Y\" |\n| | for local temporary tables. |\n+---------------------------+------------------------------------------------+\n\nSimilar information can be found in the information_schema.TABLES table as\nwell as by using mariadb-show:\n\nmariadb-show --status db_name\n\nViews\n-----\n\nFor views, all columns in SHOW TABLE STATUS are NULL except \'Name\' and\n\'Comment\'\n\nExample\n-------\n\nshow table status\\G\n*************************** 1. row ***************************\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\nURL: https://mariadb.com/kb/en/show-table-status/','','https://mariadb.com/kb/en/show-table-status/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (397,26,'SHOW TABLES','Syntax\n------\n\nSHOW [FULL] TABLES [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TABLES lists the tables (until MariaDB 11.2.0, only non-TEMPORARY tables\nare shown), sequences and views in a given database.\n\nThe LIKE clause, if present on its own, indicates which table names to match.\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW. For example, when searching for\ntables in the test database, the column name for use in the WHERE and LIKE\nclauses will be Tables_in_test\n\nThe FULL modifier is supported such that SHOW FULL TABLES displays a second\noutput column. Values for the second column, Table_type, are BASE TABLE for a\ntable, VIEW for a view and SEQUENCE for a sequence.\n\nYou can also get this information using:\n\nmariadb-show db_name\n\nSee mariadb-show for more details.\n\nIf you have no privileges for a base table or view, it does not show up in the\noutput from SHOW TABLES or mariadb-show db_name.\n\nThe information_schema.TABLES table, as well as the SHOW TABLE STATUS\nstatement, provide extended information about tables.\n\nExamples\n--------\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\nShowing temporary tables: <= MariaDB 11.1\n\nCREATE TABLE t (t int(11));\nCREATE TEMPORARY TABLE t (t int(11));\nCREATE TEMPORARY TABLE te (t int(11));\n\nSHOW TABLES;\n+----------------+\n| Tables_in_test |\n+----------------+\n| t |\n+----------------+\n\nFrom MariaDB 11.2.0:\n\nCREATE TABLE t (t int(11));\nCREATE TEMPORARY TABLE t (t int(11));\nCREATE TEMPORARY TABLE te (t int(11));\n\nSHOW TABLES;\n+----------------+\n| Tables_in_test |\n+----------------+\n| te |\n| t |\n| t |\n+----------------+\n\nURL: https://mariadb.com/kb/en/show-tables/','','https://mariadb.com/kb/en/show-tables/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (398,26,'SHOW TABLE_STATISTICS','Syntax\n------\n\nSHOW TABLE_STATISTICS\n\nDescription\n-----------\n\nThe SHOW TABLE_STATISTICS statementis part of the User Statistics feature. It\nwas removed as a separate statement in MariaDB 10.1.1, but effectively\nreplaced by the generic SHOW information_schema_table statement. The\ninformation_schema.TABLE_STATISTICS table shows statistics on table usage\n\nThe userstat system variable must be set to 1 to activate this feature. See\nthe User Statistics and information_schema.TABLE_STATISTICS articles for more\ninformation.\n\nExample\n-------\n\nSHOW TABLE_STATISTICS\\G\n*************************** 1. row ***************************\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 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 Table_schema: mysql\n Table_name: user\n Rows_read: 16\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n*************************** 4. row ***************************\n Table_schema: mysql\n Table_name: db\n Rows_read: 2\n Rows_changed: 0\nRows_changed_x_#indexes: 0\n\nURL: https://mariadb.com/kb/en/show-table-statistics/','','https://mariadb.com/kb/en/show-table-statistics/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (399,26,'SHOW TRIGGERS','Syntax\n------\n\nSHOW TRIGGERS [FROM db_name]\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW TRIGGERS lists the triggers currently defined for tables in a database\n(the default database unless a FROM clause is given). This statement requires\nthe TRIGGER privilege (prior to MySQL 5.1.22, it required the SUPER privilege).\n\nThe LIKE clause, if present on its own, indicates which table names to match\nand causes the statement to display triggers for those tables. The WHERE and\nLIKE clauses can be given to select rows using more general conditions, as\ndiscussed in Extended SHOW.\n\nSimilar information is stored in the information_schema.TRIGGERS table.\n\nMariaDB starting with 10.2.3\n----------------------------\nIf there are multiple triggers for the same action, then the triggers are\nshown in action order.\n\nExamples\n--------\n\nFor the trigger defined at Trigger Overview:\n\nSHOW triggers Like \'animals\' \\G\n*************************** 1. row ***************************\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 = animal_count.animals+100;\n ELSE \n UPDATE animal_count SET animal_count.animals = animal_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 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 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 = animal_count.animals+100;\n ELSE \n UPDATE animal_count SET animal_count.animals = animal_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\n* character_set_client is the session value of the character_set_client system\nvariable when the trigger was created. \n* collation_connection is the session value of the collation_connection system\nvariable when the trigger was\n created. \n* Database 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 NULL in the\nCreated column.\n\nURL: https://mariadb.com/kb/en/show-triggers/','','https://mariadb.com/kb/en/show-triggers/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (400,26,'SHOW USER_STATISTICS','Syntax\n------\n\nSHOW USER_STATISTICS\n\nDescription\n-----------\n\nThe SHOW USER_STATISTICS statement is part of the User Statistics feature. It\nwas removed as a separate statement in MariaDB 10.1.1, but effectively\nreplaced by the generic SHOW information_schema_table statement. The\ninformation_schema.USER_STATISTICS table holds statistics about user activity.\nYou can use this table to find out such things as which user is causing the\nmost load and which users are being abusive. You can also use this table to\nmeasure how close to capacity the server may be.\n\nThe userstat system variable must be set to 1 to activate this feature. See\nthe User Statistics and information_schema.USER_STATISTICS table for more\ninformation.\n\nExample\n-------\n\nSHOW USER_STATISTICS\\G\n*************************** 1. row ***************************\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\nURL: https://mariadb.com/kb/en/show-user-statistics/','','https://mariadb.com/kb/en/show-user-statistics/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (401,26,'SHOW VARIABLES','Syntax\n------\n\nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW VARIABLES shows the values of MariaDB system variables. This information\nalso can be obtained using the mysqladmin variables command. The LIKE clause,\nif present, indicates which variable names to match. The WHERE clause can be\ngiven to select rows using more general conditions.\n\nWith the GLOBAL modifier, SHOW VARIABLES displays the values that are used for\nnew connections to MariaDB. With SESSION, it displays the values that are in\neffect for the current connection. If no modifier is present, the default is\nSESSION. LOCAL is a synonym for SESSION. With a LIKE clause, the statement\ndisplays only rows for those variables with names that match the pattern. To\nobtain the row for a specific variable, use a LIKE clause as shown:\n\nSHOW VARIABLES LIKE \'maria_group_commit\';\nSHOW SESSION VARIABLES LIKE \'maria_group_commit\';\n\nTo get a list of variables whose name match a pattern, use the \"%\" wildcard\ncharacter in a LIKE clause:\n\nSHOW VARIABLES LIKE \'%maria%\';\nSHOW GLOBAL VARIABLES LIKE \'%maria%\';\n\nWildcard characters can be used in any position within the pattern to be\nmatched. Strictly speaking, because \"_\" is a wildcard that matches any single\ncharacter, you should escape it as \"\\_\" to match it literally. In practice,\nthis is rarely necessary.\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, 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 that can be set.\n\nYou can also see the server variables by querying the Information Schema\nGLOBAL_VARIABLES and SESSION_VARIABLES tables.\n\nExamples\n--------\n\nSHOW VARIABLES LIKE \'aria%\';\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| 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| 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| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 64 |\n+-----------------+-------+\n\nSHOW GLOBAL VARIABLES LIKE \'max_error_count\';\n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 128 |\n+-----------------+-------+\n\nBecause the following variable only has a global scope, the global value is\nreturned even when specifying SESSION (in this case by default):\n\nSHOW VARIABLES LIKE \'innodb_sync_spin_loops\';\n+------------------------+-------+\n| Variable_name | Value |\n+------------------------+-------+\n| innodb_sync_spin_loops | 30 |\n+------------------------+-------+\n\nURL: https://mariadb.com/kb/en/show-variables/','','https://mariadb.com/kb/en/show-variables/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (402,26,'SHOW WARNINGS','Syntax\n------\n\nSHOW WARNINGS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT(*) WARNINGS\n\nDescription\n-----------\n\nSHOW WARNINGS shows the error, warning, and note messages that resulted from\nthe last statement that generated messages in the current session. It shows\nnothing if the last statement used a table and generated no messages. (That\nis, a statement that uses a table but generates no messages clears the message\nlist.) Statements that do not use tables and do not generate messages have no\neffect on the message list.\n\nA note is different to a warning in that it only appears if the sql_notes\nvariable is set to 1 (the default), and is not converted to an error if strict\nmode is enabled.\n\nA related statement, SHOW ERRORS, shows only the errors.\n\nThe SHOW COUNT(*) WARNINGS statement displays the total number of errors,\nwarnings, and notes. You can also retrieve this number from the warning_count\nvariable:\n\nSHOW COUNT(*) WARNINGS;\nSELECT @@warning_count;\n\nThe value of warning_count might be greater than the number of messages\ndisplayed by SHOW WARNINGS if the max_error_count system variable is set so\nlow that not all messages are stored.\n\nThe LIMIT clause has the same syntax as for the SELECT statement.\n\nSHOW WARNINGS can be used after EXPLAIN EXTENDED to see how a query is\ninternally rewritten by MariaDB.\n\nIf the sql_notes server variable is set to 1, Notes are included in the output\nof SHOW WARNINGS; if it is set to 0, this statement will not show (or count)\nNotes.\n\nThe results of SHOW WARNINGS and SHOW COUNT(*) WARNINGS are directly sent to\nthe client. If you need to access those information in a stored program, you\ncan use the GET DIAGNOSTICS 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 warnings. The \\W\ncommand will show warnings after every statement, while \\w will disable this.\nStarting the client with the --show-warnings option will show warnings after\nevery statement.\n\nMariaDB 10.3.1 implements a stored routine error stack trace. SHOW WARNINGS\ncan also be used to show more information. See the example below.\n\nExamples\n--------\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-----------\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 exist\n\nSHOW WARNINGS;\n+-------+------+-----------------------------------------+\n| Level | Code | Message |\n+-------+------+-----------------------------------------+\n| Error | 1146 | Table \'test.not_existing\' doesn\'t exist |\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 error actually\nhappened:\n\n* Line 4 in test.p1 is the OPEN command which actually raised the error\n* Line 3 in test.p2 is the CALL statement, calling p1 from p2.\n\nURL: https://mariadb.com/kb/en/show-warnings/','','https://mariadb.com/kb/en/show-warnings/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (401,26,'SHOW VARIABLES','Syntax\n------\n\nSHOW [GLOBAL | SESSION] VARIABLES\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nSHOW VARIABLES shows the values of MariaDB system variables. This information\nalso can be obtained using the mariadb-admin variables command. The LIKE\nclause, if present, indicates which variable names to match. The WHERE clause\ncan be given to select rows using more general conditions.\n\nWith the GLOBAL modifier, SHOW VARIABLES displays the values that are used for\nnew connections to MariaDB. With SESSION, it displays the values that are in\neffect for the current connection. If no modifier is present, the default is\nSESSION. LOCAL is a synonym for SESSION. With a LIKE clause, the statement\ndisplays only rows for those variables with names that match the pattern. To\nobtain the row for a specific variable, use a LIKE clause as shown:\n\nSHOW VARIABLES LIKE \'maria_group_commit\';\nSHOW SESSION VARIABLES LIKE \'maria_group_commit\';\n\nTo get a list of variables whose name match a pattern, use the \"%\" wildcard\ncharacter in a LIKE clause:\n\nSHOW VARIABLES LIKE \'%maria%\';\nSHOW GLOBAL VARIABLES LIKE \'%maria%\';\n\nWildcard characters can be used in any position within the pattern to be\nmatched. Strictly speaking, because \"_\" is a wildcard that matches any single\ncharacter, you should escape it as \"\\_\" to match it literally. In practice,\nthis is rarely necessary.\n\nThe WHERE and LIKE clauses can be given to select rows using more general\nconditions, 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 that can be set.\n\nYou can also see the server variables by querying the Information Schema\nGLOBAL_VARIABLES and SESSION_VARIABLES tables.\n\nExamples\n--------\n\nSHOW VARIABLES LIKE \'aria%\';\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| 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| 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| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 64 |\n+-----------------+-------+\n\nSHOW GLOBAL VARIABLES LIKE \'max_error_count\';\n+-----------------+-------+\n| Variable_name | Value |\n+-----------------+-------+\n| max_error_count | 128 |\n+-----------------+-------+\n\nBecause the following variable only has a global scope, the global value is\nreturned even when specifying SESSION (in this case by default):\n\nSHOW VARIABLES LIKE \'innodb_sync_spin_loops\';\n+------------------------+-------+\n| Variable_name | Value |\n+------------------------+-------+\n| innodb_sync_spin_loops | 30 |\n+------------------------+-------+\n\nURL: https://mariadb.com/kb/en/show-variables/','','https://mariadb.com/kb/en/show-variables/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (402,26,'SHOW WARNINGS','Syntax\n------\n\nSHOW WARNINGS [LIMIT [offset,] row_count]\nSHOW ERRORS [LIMIT row_count OFFSET offset]\nSHOW COUNT(*) WARNINGS\n\nDescription\n-----------\n\nSHOW WARNINGS shows the error, warning, and note messages that resulted from\nthe last statement that generated messages in the current session. It shows\nnothing if the last statement used a table and generated no messages. (That\nis, a statement that uses a table but generates no messages clears the message\nlist.) Statements that do not use tables and do not generate messages have no\neffect on the message list.\n\nA note is different to a warning in that it only appears if the sql_notes\nvariable is set to 1 (the default), and is not converted to an error if strict\nmode is enabled.\n\nA related statement, SHOW ERRORS, shows only the errors.\n\nThe SHOW COUNT(*) WARNINGS statement displays the total number of errors,\nwarnings, and notes. You can also retrieve this number from the warning_count\nvariable:\n\nSHOW COUNT(*) WARNINGS;\nSELECT @@warning_count;\n\nThe value of warning_count might be greater than the number of messages\ndisplayed by SHOW WARNINGS if the max_error_count system variable is set so\nlow that not all messages are stored.\n\nThe LIMIT clause has the same syntax as for the SELECT statement.\n\nSHOW WARNINGS can be used after EXPLAIN EXTENDED to see how a query is\ninternally rewritten by MariaDB.\n\nIf the sql_notes server variable is set to 1, Notes are included in the output\nof SHOW WARNINGS; if it is set to 0, this statement will not show (or count)\nNotes.\n\nThe results of SHOW WARNINGS and SHOW COUNT(*) WARNINGS are directly sent to\nthe client. If you need to access those information in a stored program, you\ncan use the GET DIAGNOSTICS statement instead.\n\nFor a list of MariaDB error codes, see MariaDB Error Codes.\n\nThe mariadb client also has a number of options related to warnings. The \\W\ncommand will show warnings after every statement, while \\w will disable this.\nStarting the client with the --show-warnings option will show warnings after\nevery statement.\n\nMariaDB implements a stored routine error stack trace. SHOW WARNINGS can also\nbe used to show more information. See the example below.\n\nExamples\n--------\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-----------\n\nDisplaying 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 exist\n\nSHOW WARNINGS;\n+-------+------+-----------------------------------------+\n| Level | Code | Message |\n+-------+------+-----------------------------------------+\n| Error | 1146 | Table \'test.not_existing\' doesn\'t exist |\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 error actually\nhappened:\n\n* Line 4 in test.p1 is the OPEN command which actually raised the error\n* Line 3 in test.p2 is the CALL statement, calling p1 from p2.\n\nURL: https://mariadb.com/kb/en/show-warnings/','','https://mariadb.com/kb/en/show-warnings/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (403,26,'SHOW WSREP_MEMBERSHIP','SHOW WSREP_MEMBERSHIP is part of the WSREP_INFO plugin.\n\nSyntax\n------\n\nSHOW WSREP_MEMBERSHIP\n\nDescription\n-----------\n\nThe SHOW WSREP_MEMBERSHIP statement returns Galera node cluster membership\ninformation. It returns the same information as found in the\ninformation_schema.WSREP_MEMBERSHIP table. Only users with the SUPER privilege\ncan access this information.\n\nExamples\n--------\n\nSHOW WSREP_MEMBERSHIP;\n+-------+--------------------------------------+----------+-----------------+\n| Index | Uuid | Name | Address |\n+-------+--------------------------------------+----------+-----------------+\n| 0 | 19058073-8940-11e4-8570-16af7bf8fced | my_node1 | 10.0.2.15:16001 |\n| 1 | 19f2b0e0-8942-11e4-9cb8-b39e8ee0b5dd | my_node3 | 10.0.2.15:16003 |\n| 2 | d85e62db-8941-11e4-b1ef-4bc9980e476d | my_node2 | 10.0.2.15:16002 |\n+-------+--------------------------------------+----------+-----------------+\n\nURL: https://mariadb.com/kb/en/show-wsrep_membership/','','https://mariadb.com/kb/en/show-wsrep_membership/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (404,26,'SHOW WSREP_STATUS','SHOW WSREP_STATUS is part of the WSREP_INFO plugin.\n\nSyntax\n------\n\nSHOW WSREP_STATUS\n\nDescription\n-----------\n\nThe SHOW WSREP_STATUS statement returns Galera node and cluster status\ninformation. It returns the same information as found in the\ninformation_schema.WSREP_STATUS table. Only users with the SUPER privilege can\naccess this information.\n\nExamples\n--------\n\nSHOW WSREP_STATUS;\n+------------+-------------+----------------+--------------+\n| Node_Index | Node_Status | Cluster_Status | Cluster_Size |\n+------------+-------------+----------------+--------------+\n| 0 | Synced | Primary | 3 |\n+------------+-------------+----------------+--------------+\n\nURL: https://mariadb.com/kb/en/show-wsrep_status/','','https://mariadb.com/kb/en/show-wsrep_status/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (405,26,'BINLOG','Syntax\n------\n\nBINLOG \'str\'\n\nDescription\n-----------\n\nBINLOG is an internal-use statement. It is generated by the\nmariadb-binlog/mysqlbinlog program as the printable representation of certain\nevents in binary log files. The \'str\' value is a base 64-encoded string the\nthat server decodes to determine the data change indicated by the\ncorresponding event. This statement requires the SUPER privilege (<= MariaDB\n10.5.1) or theBINLOG REPLAY privilege (>= MariaDB 10.5.2).\n\nURL: https://mariadb.com/kb/en/binlog/','','https://mariadb.com/kb/en/binlog/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (405,26,'BINLOG','Syntax\n------\n\nBINLOG \'str\'\n\nDescription\n-----------\n\nBINLOG is an internal-use statement. It is generated by the mariadb-binlog\nprogram as the printable representation of certain events in binary log files.\nThe \'str\' value is a base 64-encoded string that the server decodes to\ndetermine the data change indicated by the corresponding event. This statement\nrequires the SUPER privilege (<= MariaDB 10.5.1) or the BINLOG REPLAY\nprivilege (>= MariaDB 10.5.2).\n\nURL: https://mariadb.com/kb/en/binlog/','','https://mariadb.com/kb/en/binlog/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (406,26,'PURGE BINARY LOGS','Syntax\n------\n\nPURGE { BINARY | MASTER } LOGS\n { TO \'log_name\' | BEFORE datetime_expr }\n\nDescription\n-----------\n\nThe PURGE BINARY LOGS statement deletes all the binary log files listed in the\nlog index file prior to the specified log file name or date. BINARY and MASTER\nare synonyms. Deleted log files also are removed from the list recorded in the\nindex file, so that the given log file becomes the first in the list.\n\nThe datetime expression is in the format \'YYYY-MM-DD hh:mm:ss\'.\n\nIf a replica is active but has yet to read from a binary log file you attempt\nto delete, the statement will fail with an error. However, if the replica is\nnot connected and has yet to read from a log file you delete, the file will be\ndeleted, but the replica will be unable to continue replicating once it\nconnects again.\n\nThis statement has no effect if the server was not started with the --log-bin\noption to enable binary logging.\n\nTo list the binary log files on the server, use SHOW BINARY LOGS. To see which\nfiles they are reading, use SHOW SLAVE STATUS (or SHOW REPLICA STATUS from\nMariaDB 10.5.1). You can only delete the files that are older than the oldest\nfile that is used by the slaves.\n\nTo delete all binary log files, use RESET MASTER. To move to a new log file\n(for example if you want to remove the current log file), use FLUSH LOGS\nbefore you execute PURGE LOGS.\n\nIf the expire_logs_days server system variable is not set to 0, the server\nautomatically deletes binary log files after the given number of days. From\nMariaDB 10.6, the binlog_expire_logs_seconds variable allows more precise\ncontrol over binlog deletion, and takes precedence if both are non-zero.\n\nRequires the SUPER privilege or, from MariaDB 10.5.2, the BINLOG ADMIN\nprivilege, to run.\n\nExamples\n--------\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\nURL: https://mariadb.com/kb/en/purge-binary-logs/','','https://mariadb.com/kb/en/purge-binary-logs/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (407,26,'CACHE INDEX','Syntax\n------\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-----------\n\nThe CACHE INDEX statement assigns table indexes to a specific key cache. It is\nused only for MyISAM tables.\n\nA default key cache exists and cannot be destroyed. To create more key caches,\nthe key_buffer_size server system variable.\n\nThe associations between tables indexes and key caches are lost on server\nrestart. To recreate them automatically, it is necessary to configure caches\nin a configuration file and include some CACHE INDEX (and optionally LOAD\nINDEX) statements in the init file.\n\nExamples\n--------\n\nThe following statement assigns indexes from the tables t1, t2, and t3 to the\nkey 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---------------------------\n\nNormally CACHE INDEX should not take a long time to execute. Internally it\'s\nimplemented the following way:\n\n* Find the right key cache (under LOCK_global_system_variables)\n* Open the table with a TL_READ_NO_INSERT lock.\n* Flush the original key cache for the given file (under key cache lock)\n* Flush the new key cache for the given file (safety)\n* Move the file to the new key cache (under file share lock)\n\nThe only possible long operations are getting the locks for the table and\nflushing the original key cache, if there were many key blocks for the file in\nit.\n\nWe plan to also add CACHE INDEX for Aria tables if there is a need for this.\n\nURL: https://mariadb.com/kb/en/cache-index/','','https://mariadb.com/kb/en/cache-index/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (408,26,'HELP Command','Syntax\n------\n\nHELP search_string\n\nDescription\n-----------\n\nThe HELP command can be used in any MariaDB client, such as the mysql\ncommand-line client, to get basic syntax help and a short description for most\ncommands and functions.\n\nIf you provide an argument to the HELP command, the mysql client uses it as a\nsearch string to access server-side help. The proper operation of this command\nrequires that the help tables in the mysql database be initialized with help\ntopic information.\n\nIf there is no match for the search string, the search fails. Use HELP\ncontents to see a list of the help categories:\n\nHELP contents\nYou asked for help about help category: \"Contents\"\nFor more information, type \'help \', where is one of the following\ncategories:\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 Help Metadata\n Language Structure\n Plugins\n Procedures\n Sequences\n Table Maintenance\n Transactions\n User-Defined Functions\n Utility\n\nIf a search string matches multiple items, MariaDB shows a list of matching\ntopics:\n\nHELP drop\nMany help items for your request exist.\nTo make a more specific request, please type \'help \',\nwhere is one of the following\ntopics:\n ALTER TABLE\n DROP DATABASE\n DROP EVENT\n DROP FUNCTION\n DROP FUNCTION UDF\n DROP INDEX\n DROP PACKAGE\n DROP PACKAGE BODY\n DROP PROCEDURE\n DROP ROLE\n DROP SEQUENCE\n DROP SERVER\n DROP TABLE\n DROP TRIGGER\n DROP USER\n DROP VIEW\n\nThen you can enter a topic as the search string to see the help entry for that\ntopic.\n\nThe help is provided with the MariaDB server and makes use of four help tables\nfound in the mysql database: help_relation, help_topic, help_category and\nhelp_keyword. These tables are populated by the mysql_install_db or\nfill_help_table.sql scripts which, until MariaDB 10.4.7, contain data\ngenerated from an old version of MySQL.\n\nURL: https://mariadb.com/kb/en/help-command/','','https://mariadb.com/kb/en/help-command/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (409,26,'KILL [CONNECTION | QUERY]','Syntax\n------\n\nKILL [HARD | SOFT] { {CONNECTION|QUERY} thread_id | QUERY ID query_id | USER\nuser_name }\n\nDescription\n-----------\n\nEach connection to mysqld runs in a separate thread. You can see which threads\nare running with the SHOW PROCESSLIST statement and kill a thread with the\nKILL thread_id statement. KILL allows the optional CONNECTION or QUERY\nmodifier:\n\n* KILL CONNECTION is the same as KILL with no\n modifier: It terminates the connection associated with the given thread or\nquery id.\n* KILL QUERY terminates the statement that the connection thread_id is\n currently executing, but leaves the connection itself intact.\n* KILL QUERY ID terminates the query by query_id, leaving the connection\nintact.\n\nIf a connection is terminated that has an active transaction, the transaction\nwill be rolled back. If only a query is killed, the current transaction will\nstay active. See also idle_transaction_timeout.\n\nIf you have the PROCESS privilege, you can see all threads. If you have the\nSUPER privilege, or, from MariaDB 10.5.2, the CONNECTION ADMIN privilege, you\ncan kill all threads and statements. Otherwise, you can see and kill only your\nown threads and statements.\n\nKilling queries that repair or create indexes on MyISAM and Aria tables may\nresult in corrupted tables. Use the SOFT option to avoid this!\n\nThe HARD option (default) kills a command as soon as possible. If you use\nSOFT, then critical operations that may leave a table in an inconsistent state\nwill not be interrupted. Such operations include REPAIR and INDEX creation for\nMyISAM and Aria tables (REPAIR TABLE, OPTIMIZE TABLE).\n\nKILL ... USER username will kill all connections/queries for a given user.\nUSER can be specified one of the following ways:\n\n* username (Kill without regard to hostname)\n* username@hostname\n* CURRENT_USER or CURRENT_USER()\n\nIf you specify a thread id and that thread does not exist, you get the\nfollowing error:\n\nERROR 1094 (HY000): Unknown thread id: \n\nIf you specify a query id that doesn\'t exist, you get the following error:\n\nERROR 1957 (HY000): Unknown query id: \n\nHowever, if you specify a user name, no error is issued for non-connected (or\neven non-existing) users. To check if the connection/query has been killed,\nyou can use the ROW_COUNT() function.\n\nA client whose connection is killed receives the following error:\n\nERROR 1317 (70100): Query execution was interrupted\n\nTo obtain a list of existing sessions, use the SHOW PROCESSLIST statement or\nquery the Information Schema PROCESSLIST table.\n\nNote: You cannot use KILL with the Embedded MySQL Server library because the\nembedded server merely runs inside the threads of the host application. It\ndoes not create any connection threads of its own.\n\nNote: You can also use mysqladmin kill thread_id [,thread_id...] to kill\nconnections. To get a list of running queries, use mysqladmin processlist. See\nmysqladmin.\n\nPercona Toolkit contains a program, pt-kill that can be used to automatically\nkill connections that match certain criteria. For example, it can be used to\nterminate idle connections, or connections that have been busy for more than\n60 seconds.\n\nURL: https://mariadb.com/kb/en/kill/','','https://mariadb.com/kb/en/kill/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (408,26,'HELP Command','Syntax\n------\n\nHELP search_string\n\nDescription\n-----------\n\nThe HELP command can be used in any MariaDB client, such as the mariadb\ncommand-line client, to get basic syntax help and a short description for most\ncommands and functions.\n\nIf you provide an argument to the HELP command, the mariadb client uses it as\na search string to access server-side help. The proper operation of this\ncommand requires that the help tables in the mysql database be initialized\nwith help topic information.\n\nIf there is no match for the search string, the search fails. Use HELP\ncontents to see a list of the help categories:\n\nHELP contents\nYou asked for help about help category: \"Contents\"\nFor more information, type \'help \', where is one of the following\ncategories:\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 Help Metadata\n Language Structure\n Plugins\n Procedures\n Sequences\n Table Maintenance\n Transactions\n User-Defined Functions\n Utility\n\nIf a search string matches multiple items, MariaDB shows a list of matching\ntopics:\n\nHELP drop\nMany help items for your request exist.\nTo make a more specific request, please type \'help \',\nwhere is one of the following\ntopics:\n ALTER TABLE\n DROP DATABASE\n DROP EVENT\n DROP FUNCTION\n DROP FUNCTION UDF\n DROP INDEX\n DROP PACKAGE\n DROP PACKAGE BODY\n DROP PROCEDURE\n DROP ROLE\n DROP SEQUENCE\n DROP SERVER\n DROP TABLE\n DROP TRIGGER\n DROP USER\n DROP VIEW\n\nThen you can enter a topic as the search string to see the help entry for that\ntopic.\n\nThe help is provided with the MariaDB server and makes use of four help tables\nfound in the mysql database: help_relation, help_topic, help_category and\nhelp_keyword. These tables are populated by the mariadb-install-db or\nfill_help_table.sql scripts.\n\nURL: https://mariadb.com/kb/en/help-command/','','https://mariadb.com/kb/en/help-command/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (409,26,'KILL [CONNECTION | QUERY]','Syntax\n------\n\nKILL [HARD | SOFT] { {CONNECTION|QUERY} thread_id | QUERY ID query_id | USER\nuser_name }\n\nDescription\n-----------\n\nEach connection to mysqld runs in a separate thread. You can see which threads\nare running with the SHOW PROCESSLIST statement and kill a thread with the\nKILL thread_id statement. KILL allows the optional CONNECTION or QUERY\nmodifier:\n\n* KILL CONNECTION is the same as KILL with no\n modifier: It terminates the connection associated with the given thread or\nquery id.\n* KILL QUERY terminates the statement that the connection thread_id is\n currently executing, but leaves the connection itself intact.\n* KILL QUERY ID terminates the query by query_id, leaving the connection\nintact.\n\nIf a connection is terminated that has an active transaction, the transaction\nwill be rolled back. If only a query is killed, the current transaction will\nstay active. See also idle_transaction_timeout.\n\nIf you have the PROCESS privilege, you can see all threads. If you have the\nSUPER privilege, or, from MariaDB 10.5.2, the CONNECTION ADMIN privilege, you\ncan kill all threads and statements. Otherwise, you can see and kill only your\nown threads and statements.\n\nKilling queries that repair or create indexes on MyISAM and Aria tables may\nresult in corrupted tables. Use the SOFT option to avoid this!\n\nThe HARD option (default) kills a command as soon as possible. If you use\nSOFT, then critical operations that may leave a table in an inconsistent state\nwill not be interrupted. Such operations include REPAIR and INDEX creation for\nMyISAM and Aria tables (REPAIR TABLE, OPTIMIZE TABLE).\n\nKILL ... USER username will kill all connections/queries for a given user.\nUSER can be specified one of the following ways:\n\n* username (Kill without regard to hostname)\n* username@hostname\n* CURRENT_USER or CURRENT_USER()\n\nIf you specify a thread id and that thread does not exist, you get the\nfollowing error:\n\nERROR 1094 (HY000): Unknown thread id: \n\nIf you specify a query id that doesn\'t exist, you get the following error:\n\nERROR 1957 (HY000): Unknown query id: \n\nHowever, if you specify a user name, no error is issued for non-connected (or\neven non-existing) users. To check if the connection/query has been killed,\nyou can use the ROW_COUNT() function.\n\nA client whose connection is killed receives the following error:\n\nERROR 1317 (70100): Query execution was interrupted\n\nTo obtain a list of existing sessions, use the SHOW PROCESSLIST statement or\nquery the Information Schema PROCESSLIST table.\n\nNote: You cannot use KILL with the Embedded MariaDB Server library because the\nembedded server merely runs inside the threads of the host application. It\ndoes not create any connection threads of its own.\n\nNote: You can also use mariadb-admin kill thread_id [,thread_id...] to kill\nconnections. To get a list of running queries, use mariadb-admin processlist.\nSee mariadb-admin.\n\nPercona Toolkit contains a program, pt-kill that can be used to automatically\nkill connections that match certain criteria. For example, it can be used to\nterminate idle connections, or connections that have been busy for more than\n60 seconds.\n\nURL: https://mariadb.com/kb/en/kill/','','https://mariadb.com/kb/en/kill/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (410,26,'LOAD INDEX','Syntax\n------\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-----------\n\nThe LOAD INDEX INTO CACHE statement preloads a table index into the key cache\nto which it has been assigned by an explicit CACHE INDEX statement, or into\nthe default key cache otherwise. LOAD INDEX INTO CACHE is used only for MyISAM\nor Aria tables.\n\nThe IGNORE LEAVES modifier causes only blocks for the nonleaf nodes of the\nindex to be preloaded.\n\nURL: https://mariadb.com/kb/en/load-index/','','https://mariadb.com/kb/en/load-index/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (411,26,'RESET','Syntax\n------\n\nRESET reset_option [, reset_option] ...\n\nDescription\n-----------\n\nThe RESET statement is used to clear the state of various server operations.\nYou must have the RELOAD privilege to execute RESET.\n\nRESET acts as a stronger version of the FLUSH statement.\n\nThe different RESET options are:\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| SLAVE | Deletes all relay logs from the slave and |\n| [\"connection_name\"] [ALL] | reset the replication position in the master |\n| | binary log. |\n+---------------------------+------------------------------------------------+\n| MASTER | Deletes all old binary logs, makes the binary |\n| | index file (--log-bin-index) empty and |\n| | creates a new binary log file. This is |\n| | useful when you want to reset the master to |\n| | an initial state. If you want to just delete |\n| | old, not used binary logs, you should use the |\n| | PURGE BINARY LOGS command. |\n+---------------------------+------------------------------------------------+\n| QUERY CACHE | Removes all queries from the query cache. See |\n| | also FLUSH QUERY CACHE. |\n+---------------------------+------------------------------------------------+\n\nURL: https://mariadb.com/kb/en/reset/','','https://mariadb.com/kb/en/reset/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (412,26,'SHUTDOWN','Syntax\n------\n\nSHUTDOWN [WAIT FOR ALL { SLAVES | REPLICAS } ]\n\nDescription\n-----------\n\nThe SHUTDOWN command shuts the server down.\n\nWAIT FOR ALL SLAVES\n-------------------\n\nMariaDB starting with 10.4.4\n----------------------------\nThe WAIT FOR ALL SLAVES option was first added in MariaDB 10.4.4. WAIT FOR ALL\nREPLICAS has been a synonym since MariaDB 10.5.1.\n\nWhen a master server is shutdown and it goes through the normal shutdown\nprocess, the master kills client threads in random order. By default, the\nmaster also considers its binary log dump threads to be regular client\nthreads. As a consequence, the binary log dump threads can be killed while\nclient threads still exist, and this means that data can be written on the\nmaster during a normal shutdown that won\'t be replicated. This is true even if\nsemi-synchronous replication is being used.\n\nIn MariaDB 10.4 and later, this problem can be solved by shutting down the\nserver with the SHUTDOWN command and by providing the WAIT FOR ALL SLAVES\noption to the command. For example:\n\nSHUTDOWN WAIT FOR ALL SLAVES;\n\nWhen the WAIT FOR ALL SLAVES option is provided, the server only kills its\nbinary log dump threads after all client threads have been killed, and it only\ncompletes the shutdown after the last binary log has been sent to all\nconnected replicas.\n\nSee Replication Threads: Binary Log Dump Threads and the Shutdown Process for\nmore information.\n\nRequired Permissions\n--------------------\n\nOne must have a SHUTDOWN privilege (see GRANT) to use this command. It is the\nsame privilege one needs to use the mariadb-admin/mysqladmin shutdown command.\n\nShutdown for Upgrades\n---------------------\n\nIf you are doing a shutdown to migrate to another major version of MariaDB,\nplease ensure that the innodb_fast_shutdown variable is not 2 (fast crash\nshutdown). The default of this variable is 1.\n\nExample\n-------\n\nThe following example shows how to create an event which turns off the server\nat a certain time:\n\nCREATE EVENT `test`.`shutd`\n ON SCHEDULE\n EVERY 1 DAY\n STARTS \'2014-01-01 20:00:00\'\n COMMENT \'Shutdown Maria when the office is closed\'\nDO BEGIN\n SHUTDOWN;\nEND;\n\nOther Ways to Stop mysqld\n-------------------------\n\nYou can use the mariadb-admin/mysqladmin shutdown command to take down mysqld\ncleanly.\n\nYou can also use the system kill command on Unix with signal SIGTERM (15)\n\nkill -SIGTERM pid-of-mysqld-process\n\nYou can find the process number of the server process in the file that ends\nwith .pid in your data directory.\n\nThe above is identical to mysqladmin shutdown.\n\nOn windows you should use:\n\nNET STOP MySQL\n\nURL: https://mariadb.com/kb/en/shutdown/','','https://mariadb.com/kb/en/shutdown/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (413,26,'USE','Syntax\n------\n\nUSE db_name\n\nDescription\n-----------\n\nThe \'USE db_name\' statement tells MariaDB to use the db_name database as the\ndefault (current) database for subsequent statements. The database remains the\ndefault until the end of the session or another USE statement is issued:\n\nUSE db1;\nSELECT COUNT(*) FROM mytable; # selects from db1.mytable\nUSE db2;\nSELECT COUNT(*) FROM mytable; # selects from db2.mytable\n\nThe DATABASE() function (SCHEMA() is a synonym) returns the default database.\n\nAnother way to set the default database is specifying its name at mysql\ncommand line client startup.\n\nURL: https://mariadb.com/kb/en/use/','','https://mariadb.com/kb/en/use/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (412,26,'SHUTDOWN','Syntax\n------\n\nSHUTDOWN [WAIT FOR ALL { SLAVES | REPLICAS } ]\n\nDescription\n-----------\n\nThe SHUTDOWN command shuts the server down.\n\nWAIT FOR ALL REPLICAS / SLAVES\n------------------------------\n\nMariaDB starting with 10.4.4\n----------------------------\nThe WAIT FOR ALL SLAVES option was first added in MariaDB 10.4.4. WAIT FOR ALL\nREPLICAS has been a synonym since MariaDB 10.5.1.\n\nWhen a primary server is shutdown and it goes through the normal shutdown\nprocess, the primary kills client threads in random order. By default, the\nprimary also considers its binary log dump threads to be regular client\nthreads. As a consequence, the binary log dump threads can be killed while\nclient threads still exist, and this means that data can be written on the\nprimary during a normal shutdown that won\'t be replicated. This is true even\nif semi-synchronous replication is being used.\n\nIn MariaDB 10.4 and later, this problem can be solved by shutting down the\nserver with the SHUTDOWN command and by providing the WAIT FOR ALL\nREPLICAS/WAIT FOR ALL SLAVES option to the command. For example:\n\nSHUTDOWN WAIT FOR ALL REPLICAS;\n\nWhen the WAIT FOR ALL REPLICAS option is provided, the server only kills its\nbinary log dump threads after all client threads have been killed, and it only\ncompletes the shutdown after the last binary log has been sent to all\nconnected replicas.\n\nSee Replication Threads: Binary Log Dump Threads and the Shutdown Process for\nmore information.\n\nRequired Permissions\n--------------------\n\nOne must have a SHUTDOWN privilege (see GRANT) to use this command. It is the\nsame privilege one needs to use the mariadb-admin shutdown command.\n\nShutdown for Upgrades\n---------------------\n\nIf you are doing a shutdown to migrate to another major version of MariaDB,\nplease ensure that the innodb_fast_shutdown variable is not 2 (fast crash\nshutdown). The default of this variable is 1.\n\nExample\n-------\n\nThe following example shows how to create an event which turns off the server\nat a certain time:\n\nCREATE EVENT `test`.`shutd`\n ON SCHEDULE\n EVERY 1 DAY\n STARTS \'2014-01-01 20:00:00\'\n COMMENT \'Shutdown Maria when the office is closed\'\nDO BEGIN\n SHUTDOWN;\nEND;\n\nOther Ways to Stop mysqld\n-------------------------\n\nYou can use the mariadb-admin shutdown command to take down mysqld cleanly.\n\nYou can also use the system kill command on Unix with signal SIGTERM (15)\n\nkill -SIGTERM pid-of-mysqld-process\n\nYou can find the process number of the server process in the file that ends\nwith .pid in your data directory.\n\nThe above is identical to mariadb-admin shutdown.\n\nOn windows you should use:\n\nNET STOP MySQL\n\nURL: https://mariadb.com/kb/en/shutdown/','','https://mariadb.com/kb/en/shutdown/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (413,26,'USE [DATABASE]','Syntax\n------\n\nUSE db_name\n\nIn MariaDB 11.3 one can also use\n\nUSE DATABASE db_name;\n\nDescription\n-----------\n\nThe \'USE db_name\' statement tells MariaDB to use the db_name database as the\ndefault (current) database for subsequent statements. The database remains the\ndefault until the end of the session or another USE statement is issued:\n\nUSE db1;\nSELECT COUNT(*) FROM mytable; # selects from db1.mytable\nUSE db2;\nSELECT COUNT(*) FROM mytable; # selects from db2.mytable\n\nThe DATABASE() function (SCHEMA() is a synonym) returns the default database.\n\nAnother way to set the default database is specifying its name at mariadb\ncommand line client startup.\n\nOne cannot use USE DATABASE to a database one has no privileges to. The reason\nis that a user with no privileges to a database should not be able to know if\na database exists or not.\n\nURL: https://mariadb.com/kb/en/use-database/','','https://mariadb.com/kb/en/use-database/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (414,26,'SHOW FUNCTION CODE','Syntax\n------\n\nSHOW FUNCTION CODE func_name\n\nDescription\n-----------\n\nSHOW FUNCTION CODE shows a representation of the internal implementation of\nthe stored function.\n\nIt is similar to SHOW PROCEDURE CODE but for stored functions.\n\nURL: https://mariadb.com/kb/en/show-function-code/','','https://mariadb.com/kb/en/show-function-code/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (415,26,'SHOW COLLATION','Syntax\n------\n\nSHOW COLLATION\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThe output from SHOW COLLATION includes all available collations. The LIKE\nclause, if present on its own, indicates which collation names to match. The\nWHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe same information can be queried from the Information Schema COLLATIONS\ntable.\n\nSee Setting Character Sets and Collations for details on specifying the\ncollation at the server, database, table and column levels.\n\nExamples\n--------\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 \'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\nURL: https://mariadb.com/kb/en/show-collation/','','https://mariadb.com/kb/en/show-collation/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (415,26,'SHOW COLLATION','Syntax\n------\n\nSHOW COLLATION\n [LIKE \'pattern\' | WHERE expr]\n\nDescription\n-----------\n\nThe output from SHOW COLLATION includes all available collations. The LIKE\nclause, if present on its own, indicates which collation names to match. The\nWHERE and LIKE clauses can be given to select rows using more general\nconditions, as discussed in Extended SHOW.\n\nThe same information can be queried from the Information Schema COLLATIONS\ntable.\n\nSee Setting Character Sets and Collations for details on specifying the\ncollation at the server, database, table and column levels.\n\nExamples\n--------\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| latin1_swedish_nopad_ci | latin1 | 1032 | | Yes | 1 |\n| latin1_nopad_bin | latin1 | 1071 | | Yes | 1 |\n+-------------------------+---------+------+---------+----------+---------+\n\nSHOW COLLATION WHERE Sortlen LIKE \'8\' AND Charset LIKE \'utf8mb4\';\n+------------------------------+---------+------+---------+----------+---------\n\n| Collation | Charset | Id | Default | Compiled | Sortlen\n|\n+------------------------------+---------+------+---------+----------+---------\n\n| utf8mb4_unicode_ci | utf8mb4 | 224 | | Yes | 8\n|\n| utf8mb4_icelandic_ci | utf8mb4 | 225 | | Yes | 8\n|\n| utf8mb4_latvian_ci | utf8mb4 | 226 | | Yes | 8\n|\n| utf8mb4_romanian_ci | utf8mb4 | 227 | | Yes | 8\n|\n| utf8mb4_slovenian_ci | utf8mb4 | 228 | | Yes | 8\n|\n| utf8mb4_polish_ci | utf8mb4 | 229 | | Yes | 8\n|\n| utf8mb4_estonian_ci | utf8mb4 | 230 | | Yes | 8\n|\n| utf8mb4_spanish_ci | utf8mb4 | 231 | | Yes | 8\n|\n| utf8mb4_swedish_ci | utf8mb4 | 232 | | Yes | 8\n|\n| utf8mb4_turkish_ci | utf8mb4 | 233 | | Yes | 8\n|\n| utf8mb4_czech_ci | utf8mb4 | 234 | | Yes | 8\n|\n| utf8mb4_danish_ci | utf8mb4 | 235 | | Yes | 8\n|\n| utf8mb4_lithuanian_ci | utf8mb4 | 236 | | Yes | 8\n|\n| utf8mb4_slovak_ci | utf8mb4 | 237 | | Yes | 8\n|\n| utf8mb4_spanish2_ci | utf8mb4 | 238 | | Yes | 8\n|\n| utf8mb4_roman_ci | utf8mb4 | 239 | | Yes | 8\n|\n| utf8mb4_persian_ci | utf8mb4 | 240 | | Yes | 8\n|\n| utf8mb4_esperanto_ci | utf8mb4 | 241 | | Yes | 8\n|\n| utf8mb4_hungarian_ci | utf8mb4 | 242 | | Yes | 8\n|\n| utf8mb4_sinhala_ci | utf8mb4 | 243 | | Yes | 8\n|\n| utf8mb4_german2_ci | utf8mb4 | 244 | | Yes | 8\n|\n| utf8mb4_croatian_mysql561_ci | utf8mb4 | 245 | | Yes | 8\n|\n| utf8mb4_unicode_520_ci | utf8mb4 | 246 | | Yes | 8\n|\n| utf8mb4_vietnamese_ci | utf8mb4 | 247 | | Yes | 8\n|\n| utf8mb4_croatian_ci | utf8mb4 | 608 | | Yes | 8\n|\n| utf8mb4_myanmar_ci | utf8mb4 | 609 | | Yes | 8\n|\n| utf8mb4_unicode_nopad_ci | utf8mb4 | 1248 | | Yes | 8\n|\n| utf8mb4_unicode_520_nopad_ci | utf8mb4 | 1270 | | Yes | 8\n|\n+------------------------------+---------+------+---------+----------+---------\n\nURL: https://mariadb.com/kb/en/show-collation/','','https://mariadb.com/kb/en/show-collation/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (416,27,'DELETE','Syntax\n------\n\nSingle-table syntax:\n\nDELETE [LOW_PRIORITY] [QUICK] [IGNORE] \n FROM tbl_name [PARTITION (partition_list)]\n [FOR PORTION OF period FROM expr1 TO expr2]\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-----------\n\n+---------------------------+------------------------------------------------+\n| Option | Description |\n+---------------------------+------------------------------------------------+\n| LOW_PRIORITY | Wait until all SELECT\'s are done before |\n| | starting the statement. Used with storage |\n| | engines that uses table locking (MyISAM, Aria |\n| | etc). See HIGH_PRIORITY and LOW_PRIORITY |\n| | clauses for details. |\n+---------------------------+------------------------------------------------+\n| QUICK | Signal the storage engine that it should |\n| | expect that a lot of rows are deleted. The |\n| | storage engine engine can do things to speed |\n| | up the DELETE like ignoring merging of data |\n| | blocks until all rows are deleted from the |\n| | block (instead of when a block is half full). |\n| | This speeds up things at the expanse of lost |\n| | space in data blocks. At least MyISAM and |\n| | Aria support this feature. |\n+---------------------------+------------------------------------------------+\n| IGNORE | Don\'t stop the query even if a not-critical |\n| | error occurs (like data overflow). See How |\n| | IGNORE works for a full description. |\n+---------------------------+------------------------------------------------+\n\nFor the single-table syntax, the DELETE statement deletes rows from tbl_name\nand returns a count of the number of deleted rows. This count can be obtained\nby calling the ROW_COUNT() function. The WHERE clause, if given, specifies the\nconditions that identify which rows to delete. With no WHERE clause, all rows\nare deleted. If the ORDER BY clause is specified, the rows are deleted in the\norder that is specified. The LIMIT clause places a limit on the number of rows\nthat can be deleted.\n\nFor the multiple-table syntax, DELETE deletes from each tbl_name the rows that\nsatisfy the conditions. In this case, ORDER BY and LIMIT> cannot be used. A\nDELETE can also reference tables which are located in different databases; see\nIdentifier Qualifiers for the syntax.\n\nwhere_condition is an expression that evaluates to true for each row to be\ndeleted. It is specified as described in SELECT.\n\nCurrently, you cannot delete from a table and select from the same table in a\nsubquery.\n\nYou need the DELETE privilege on a table to delete rows from it. You need only\nthe SELECT privilege for any columns that are only read, such as those named\nin the WHERE clause. See GRANT.\n\nAs stated, a DELETE statement with no WHERE clause deletes all rows. A faster\nway to do this, when you do not need to know the number of deleted rows, is to\nuse TRUNCATE TABLE. However, within a transaction or if you have a lock on the\ntable, TRUNCATE TABLE cannot be used whereas DELETE can. See TRUNCATE TABLE,\nand LOCK.\n\nPARTITION\n---------\n\nSee Partition Pruning and Selection for details.\n\nFOR PORTION OF\n--------------\n\nMariaDB starting with 10.4.3\n----------------------------\nSee Application Time Periods - Deletion by Portion.\n\nRETURNING\n---------\n\nIt is possible to return a resultset of the deleted rows for a single table to\nthe client by using the syntax DELETE ... RETURNING select_expr [,\nselect_expr2 ...]]\n\nAny of SQL expression that can be calculated from a single row fields is\nallowed. Subqueries are allowed. The AS keyword is allowed, so it is possible\nto use aliases.\n\nThe use of aggregate functions is not allowed. RETURNING cannot be used in\nmulti-table DELETEs.\n\nMariaDB starting with 10.3.1\n----------------------------\n\nSame Source and Target Table\n----------------------------\n\nUntil MariaDB 10.3.1, deleting from a table with the same source and target\nwas not possible. From MariaDB 10.3.1, this is now possible. For example:\n\nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE b.c2=0);\n\nMariaDB starting with 10.3.4\n----------------------------\n\nDELETE HISTORY\n--------------\n\nOne can use DELETE HISTORY to delete historical information from\nSystem-versioned tables.\n\nExamples\n--------\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| f1 |\n+------+\n| 5 |\n| 50 |\n| 500 |\n+------+\n\nThe following statement joins two tables: one is only used to satisfy a WHERE\ncondition, but no row is deleted from it; rows from the other table are\ndeleted, instead.\n\nDELETE post FROM blog INNER JOIN post WHERE blog.id = post.blog_id;\n\nDeleting from the Same Source and Target\n----------------------------------------\n\nCREATE TABLE t1 (c1 INT, c2 INT);\nDELETE FROM t1 WHERE c1 IN (SELECT b.c1 FROM t1 b WHERE b.c2=0);\n\nUntil MariaDB 10.3.1, this returned:\n\nERROR 1093 (HY000): Table \'t1\' is specified twice, both as a target for\n\'DELETE\' \n and as a separate source for\n\nFrom MariaDB 10.3.1:\n\nQuery OK, 0 rows affected (0.00 sec)\n\nURL: https://mariadb.com/kb/en/delete/','','https://mariadb.com/kb/en/delete/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (417,27,'REPLACE','Syntax\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 works exactly like INSERT, except that if an old row in the table has\nthe same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row\nis deleted before the new row is inserted. If the table has more than one\nUNIQUE keys, it is possible 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 or, if a default\ndatabase is selected, in the form tbl_name (see Identifier Qualifiers). This\nallows to use REPLACE ... SELECT to copy rows between different databases.\n\nMariaDB starting with 10.5.0\n----------------------------\nThe RETURNING clause was introduced in MariaDB 10.5.0\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=# ;\nENDIF\nINSERT INTO t1 VALUES (...);\nEND;\n\nThe above can be replaced with:\n\nREPLACE INTO t1 VALUES (...)\n\nREPLACE is a MariaDB/MySQL extension to the SQL standard. It either inserts,\nor deletes and inserts. For other MariaDB/MySQL extensions to standard SQL ---\nthat also handle duplicate values --- see IGNORE and INSERT ON DUPLICATE KEY\nUPDATE.\n\nNote that unless the table has a PRIMARY KEY or UNIQUE index, using a REPLACE\nstatement makes no sense. It becomes equivalent to INSERT, because there is no\nindex to be used to determine whether a new row duplicates another.\n\nValues for all columns are taken from the values sSee Partition Pruning and\nSelection for details.pecified in the REPLACE statement. Any missing columns\nare set to their default values, just as happens for INSERT. You cannot refer\nto values from the current row and use them in the new row. If you use an\nassignment such as \'SET col = col + 1\', the reference to the column name on\nthe right hand side is treated as DEFAULT(col), so the assignment is\nequivalent to \'SET col = DEFAULT(col) + 1\'.\n\nTo use REPLACE, you must have both the INSERT and DELETE privileges for the\ntable.\n\nThere are some gotchas you should be aware of, before using REPLACE:\n\n* If there is an AUTO_INCREMENT field, a new value will be generated.\n* If there are foreign keys, ON DELETE action will be activated by REPLACE.\n* Triggers on DELETE and INSERT will be activated by REPLACE.\n\nTo avoid some of these behaviors, you can use INSERT ... ON DUPLICATE KEY\nUPDATE.\n\nThis statement activates INSERT and DELETE triggers. See Trigger Overview for\ndetails.\n\nPARTITION\n---------\n\nSee Partition Pruning and Selection for details.\n\nREPLACE RETURNING\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 REPLACE...SEL==\nDescription\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. ECT...RETURNING if the table in the RETURNING\nclause is not the same as the REPLACE table.\n\nURL: https://mariadb.com/kb/en/replace/','','https://mariadb.com/kb/en/replace/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (418,27,'UPDATE','Syntax\n------\n\nSingle-table syntax:\n\nUPDATE [LOW_PRIORITY] [IGNORE] table_reference \n [PARTITION (partition_list)]\n [FOR PORTION OF period FROM expr1 TO expr2]\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-----------\n\nFor the single-table syntax, the UPDATE statement updates columns of existing\nrows in the named table with new values. The SET clause indicates which\ncolumns to modify and the values they should be given. Each value can be given\nas an expression, or the keyword DEFAULT to set a column explicitly to its\ndefault value. The WHERE clause, if given, specifies the conditions that\nidentify which rows to update. With no WHERE clause, all rows are updated. If\nthe ORDER BY clause is specified, the rows are updated in the order that is\nspecified. The LIMIT clause places a limit on the number of rows that can be\nupdated.\n\nUntil MariaDB 10.3.2, for the multiple-table syntax, UPDATE updates rows in\neach table named in table_references that satisfy the conditions. In this\ncase, ORDER BY and LIMIT cannot be used. This restriction was lifted in\nMariaDB 10.3.2 and both clauses can be used with multiple-table updates. An\nUPDATE can also reference tables which are located in different databases; see\nIdentifier Qualifiers for the syntax.\n\nwhere_condition is an expression that evaluates to true for each row to be\nupdated.\n\ntable_references and where_condition are as specified as described in SELECT.\n\nFor single-table updates, assignments are evaluated in left-to-right order,\nwhile for multi-table updates, there is no guarantee of a particular order. If\nthe SIMULTANEOUS_ASSIGNMENT sql_mode (available from MariaDB 10.3.5) is set,\nUPDATE statements evaluate all assignments simultaneously.\n\nYou need the UPDATE privilege only for columns referenced in an UPDATE that\nare actually updated. You need only the SELECT privilege for any columns that\nare read but not modified. See GRANT.\n\nThe UPDATE statement supports the following modifiers:\n\n* If you use the LOW_PRIORITY keyword, execution of\n the UPDATE is delayed until no other clients are reading from\n the table. This affects only storage engines that use only table-level\n locking (MyISAM, MEMORY, MERGE). See HIGH_PRIORITY and LOW_PRIORITY clauses\nfor details.\n* If you use the IGNORE keyword, the update statement does \n not abort even if errors occur during the update. Rows for which\n duplicate-key conflicts occur are not updated. Rows for which columns are\n updated to values that would cause data conversion errors are updated to the\n closest valid values instead.\n\nPARTITION\n---------\n\nSee Partition Pruning and Selection for details.\n\nFOR PORTION OF\n--------------\n\nMariaDB starting with 10.4.3\n----------------------------\nSee Application Time Periods - Updating by Portion.\n\nUPDATE Statements With the Same Source and Target\n-------------------------------------------------\n\nMariaDB starting with 10.3.2\n----------------------------\nFrom MariaDB 10.3.2, UPDATE statements may have the same source and target.\n\nFor example, given the following table:\n\nDROP TABLE t1;\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 not 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 for 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| c1 | c2 |\n+------+------+\n| 10 | 10 |\n| 21 | 20 |\n+------+------+\n\nExample\n-------\n\nSingle-table syntax:\n\nUPDATE table_name SET column1 = value1, column2 = value2 WHERE id=100;\n\nMultiple-table syntax:\n\nUPDATE tab1, tab2 SET tab1.column1 = value1, tab1.column2 = value2 WHERE\ntab1.id = tab2.id;\n\nURL: https://mariadb.com/kb/en/update/','','https://mariadb.com/kb/en/update/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (419,27,'IGNORE','The IGNORE option tells the server to ignore some common errors.\n\nIGNORE can be used with the following statements:\n\n* DELETE\n* INSERT (see also INSERT IGNORE)\n* LOAD DATA INFILE\n* UPDATE\n* ALTER TABLE\n* CREATE TABLE ... SELECT\n* INSERT ... SELECT\n\nThe logic used:\n\n* Variables out of ranges are replaced with the maximum/minimum value.\n\n* SQL_MODEs STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE,\nNO_ZERO_DATE are ignored.\n\n* Inserting NULL in a NOT NULL field will insert 0 ( in a numerical\n field), 0000-00-00 ( in a date field) or an empty string ( in a character\n field).\n\n* Rows that cause a duplicate key error or break a foreign key constraint are\n not inserted, updated, or deleted.\n\nThe following errors are ignored:\n\n+---------------------+---------------------------------+--------------------+\n| Error number | Symbolic error name | Description |\n+---------------------+---------------------------------+--------------------+\n| 1022 | ER_DUP_KEY | Can\'t write; |\n| | | duplicate key in |\n| | | table \'%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1048 | ER_BAD_NULL_ERROR | Column \'%s\' |\n| | | cannot be null |\n+---------------------+---------------------------------+--------------------+\n| 1062 | ER_DUP_ENTRY | Duplicate entry |\n| | | \'%s\' for key %d |\n+---------------------+---------------------------------+--------------------+\n| 1242 | ER_SUBQUERY_NO_1_ROW | Subquery returns |\n| | | more than 1 row |\n+---------------------+---------------------------------+--------------------+\n| 1264 | ER_WARN_DATA_OUT_OF_RANGE | Out of range |\n| | | value for column |\n| | | \'%s\' at row %ld |\n+---------------------+---------------------------------+--------------------+\n| 1265 | WARN_DATA_TRUNCATED | Data truncated |\n| | | for column \'%s\' |\n| | | at row %ld |\n+---------------------+---------------------------------+--------------------+\n| 1292 | ER_TRUNCATED_WRONG_VALUE | Truncated |\n| | | incorrect %s |\n| | | value: \'%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1366 | ER_TRUNCATED_WRONG_VALUE_FOR_FI | Incorrect integer |\n| | LD | value |\n+---------------------+---------------------------------+--------------------+\n| 1369 | ER_VIEW_CHECK_FAILED | CHECK OPTION |\n| | | failed \'%s.%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1451 | ER_ROW_IS_REFERENCED_2 | Cannot delete or |\n| | | update a parent |\n| | | row |\n+---------------------+---------------------------------+--------------------+\n| 1452 | ER_NO_REFERENCED_ROW_2 | Cannot add or |\n| | | update a child |\n| | | row: a foreign |\n| | | key constraint |\n| | | fails (%s) |\n+---------------------+---------------------------------+--------------------+\n| 1526 | ER_NO_PARTITION_FOR_GIVEN_VALUE | Table has no |\n| | | partition for |\n| | | value %s |\n+---------------------+---------------------------------+--------------------+\n| 1586 | ER_DUP_ENTRY_WITH_KEY_NAME | Duplicate entry |\n| | | \'%s\' for key \'%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1591 | ER_NO_PARTITION_FOR_GIVEN_VALUE | Table has no |\n| | SILENT | partition for |\n| | | some existing |\n| | | values |\n+---------------------+---------------------------------+--------------------+\n| 1748 | ER_ROW_DOES_NOT_MATCH_GIVEN_PAR | Found a row not |\n| | ITION_SET | matching the |\n| | | given partition |\n| | | set |\n+---------------------+---------------------------------+--------------------+\n\nIgnored errors normally generate a warning.\n\nA property of the IGNORE clause consists in causing transactional engines and\nnon-transactional engines (like XtraDB and Aria) to behave the same way. For\nexample, normally a multi-row insert which tries to violate a UNIQUE contraint\nis completely rolled back on XtraDB/InnoDB, but might be partially executed on\nAria. With the IGNORE clause, the statement will be partially executed in both\nengines.\n\nDuplicate key errors also generate warnings. The OLD_MODE server variable can\nbe used to prevent this.\n\nURL: https://mariadb.com/kb/en/ignore/','','https://mariadb.com/kb/en/ignore/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (419,27,'IGNORE','The IGNORE option tells the server to ignore some common errors.\n\nIGNORE can be used with the following statements:\n\n* DELETE\n* INSERT (see also INSERT IGNORE)\n* LOAD DATA INFILE\n* UPDATE\n* ALTER TABLE\n* CREATE TABLE ... SELECT\n* INSERT ... SELECT\n\nThe logic used:\n\n* Variables out of ranges are replaced with the maximum/minimum value.\n\n* SQL_MODEs STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE,\nNO_ZERO_DATE are ignored.\n\n* Inserting NULL in a NOT NULL field will insert 0 ( in a numerical\n field), 0000-00-00 ( in a date field) or an empty string ( in a character\n field).\n\n* Rows that cause a duplicate key error or break a foreign key constraint are\n not inserted, updated, or deleted.\n\nThe following errors are ignored:\n\n+---------------------+---------------------------------+--------------------+\n| Error number | Symbolic error name | Description |\n+---------------------+---------------------------------+--------------------+\n| 1022 | ER_DUP_KEY | Can\'t write; |\n| | | duplicate key in |\n| | | table \'%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1048 | ER_BAD_NULL_ERROR | Column \'%s\' |\n| | | cannot be null |\n+---------------------+---------------------------------+--------------------+\n| 1062 | ER_DUP_ENTRY | Duplicate entry |\n| | | \'%s\' for key %d |\n+---------------------+---------------------------------+--------------------+\n| 1242 | ER_SUBQUERY_NO_1_ROW | Subquery returns |\n| | | more than 1 row |\n+---------------------+---------------------------------+--------------------+\n| 1264 | ER_WARN_DATA_OUT_OF_RANGE | Out of range |\n| | | value for column |\n| | | \'%s\' at row %ld |\n+---------------------+---------------------------------+--------------------+\n| 1265 | WARN_DATA_TRUNCATED | Data truncated |\n| | | for column \'%s\' |\n| | | at row %ld |\n+---------------------+---------------------------------+--------------------+\n| 1292 | ER_TRUNCATED_WRONG_VALUE | Truncated |\n| | | incorrect %s |\n| | | value: \'%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1366 | ER_TRUNCATED_WRONG_VALUE_FOR_FI | Incorrect integer |\n| | LD | value |\n+---------------------+---------------------------------+--------------------+\n| 1369 | ER_VIEW_CHECK_FAILED | CHECK OPTION |\n| | | failed \'%s.%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1451 | ER_ROW_IS_REFERENCED_2 | Cannot delete or |\n| | | update a parent |\n| | | row |\n+---------------------+---------------------------------+--------------------+\n| 1452 | ER_NO_REFERENCED_ROW_2 | Cannot add or |\n| | | update a child |\n| | | row: a foreign |\n| | | key constraint |\n| | | fails (%s) |\n+---------------------+---------------------------------+--------------------+\n| 1526 | ER_NO_PARTITION_FOR_GIVEN_VALUE | Table has no |\n| | | partition for |\n| | | value %s |\n+---------------------+---------------------------------+--------------------+\n| 1586 | ER_DUP_ENTRY_WITH_KEY_NAME | Duplicate entry |\n| | | \'%s\' for key \'%s\' |\n+---------------------+---------------------------------+--------------------+\n| 1591 | ER_NO_PARTITION_FOR_GIVEN_VALUE | Table has no |\n| | SILENT | partition for |\n| | | some existing |\n| | | values |\n+---------------------+---------------------------------+--------------------+\n| 1748 | ER_ROW_DOES_NOT_MATCH_GIVEN_PAR | Found a row not |\n| | ITION_SET | matching the |\n| | | given partition |\n| | | set |\n+---------------------+---------------------------------+--------------------+\n\nIgnored errors normally generate a warning.\n\nA property of the IGNORE clause consists in causing transactional engines and\nnon-transactional engines (like InnoDB and Aria) to behave the same way. For\nexample, normally a multi-row insert which tries to violate a UNIQUE contraint\nis completely rolled back on InnoDB, but might be partially executed on Aria.\nWith the IGNORE clause, the statement will be partially executed in both\nengines.\n\nDuplicate key errors also generate warnings. The OLD_MODE server variable can\nbe used to prevent this.\n\nURL: https://mariadb.com/kb/en/ignore/','','https://mariadb.com/kb/en/ignore/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (420,27,'SELECT','Syntax\n------\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], ... [WITH ROLLUP]]\n [HAVING where_condition]\n [ORDER BY {col_name | expr | position} [ASC | DESC], ...]\n [LIMIT {[offset,] row_count | row_count OFFSET offset [ROWS EXAMINED\nrows_limit] } |\n [OFFSET start { ROW | ROWS }]\n [FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } { ONLY | WITH TIES }]\n]\n procedure|[PROCEDURE procedure_name(argument_list)]\n [INTO OUTFILE \'file_name\' [CHARACTER SET charset_name] [export_options] |\n INTO DUMPFILE \'file_name\' | INTO var_name [, var_name] ]\n [FOR UPDATE lock_option | LOCK IN SHARE MODE lock_option]\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 ]\nlock_option:\n [WAIT n | NOWAIT | SKIP LOCKED]\n\nDescription\n-----------\n\nSELECT is used to retrieve rows selected from one or more tables, and can\ninclude UNION statements and subqueries.\n\n* Each select_expr expression indicates a column or data that you want to\nretrieve. You\nmust have at least one select expression. See Select Expressions below.\n\n* The FROM clause indicates the table or tables from which to retrieve rows.\nUse either a single table name or a JOIN expression. See JOIN\nfor details. If no table is involved, FROM DUAL can be specified.\n\n* Each table can also be specified as db_name.tabl_name. Each column can also\nbe specified as tbl_name.col_name or even db_name.tbl_name.col_name. This\nallows one to write queries which involve multiple databases. See Identifier\nQualifiers for syntax details.\n\n* The 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 there 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 (summary) functions.\nSee Functions and Operators and Functions and Modifiers for use with GROUP BY\n(aggregate).\n\n* Use the ORDER BY clause to order the results.\n\n* Use the LIMIT clause allows you to restrict the results to only\na certain number of rows, optionally with an offset.\n\n* Use the GROUP BY and HAVING clauses to group\nrows together when they have columns or computed values in common.\n\nSELECT can also be used to retrieve rows computed without reference to any\ntable.\n\nSelect Expressions\n------------------\n\nA SELECT statement must contain one or more select expressions, separated by\ncommas. Each select expression can be one of the following:\n\n* The name of a column.\n* Any expression using functions and operators.\n* * to select all columns from all tables in the FROM clause.\n* tbl_name.* to select all columns from just the table tbl_name.\n\nWhen specifying a column, you can either use just the column name or qualify\nthe column name with the name of the table using tbl_name.col_name. The\nqualified form is useful if you are joining multiple tables in the FROM\nclause. If you do not qualify the column names when selecting from multiple\ntables, MariaDB will try to find the column in each table. It is an error if\nthat column name exists in multiple tables.\n\nYou can quote column names using backticks. If you are qualifying column names\nwith table names, quote each part separately as `tbl_name`.`col_name`.\n\nIf you use any grouping functions in any of the select expressions, all rows\nin your results will be implicitly grouped, as if you had used GROUP BY NULL.\n\nDISTINCT\n--------\n\nA query may produce some identical rows. By default, all rows are retrieved,\neven when their values are the same. To explicitly specify that you want to\nretrieve identical rows, use the ALL option. If you want duplicates to be\nremoved from the resultset, use the DISTINCT option. DISTINCTROW is a synonym\nfor DISTINCT. See also COUNT DISTINCT and SELECT UNIQUE in Oracle mode.\n\nINTO\n----\n\nThe INTO clause is used to specify that the query results should be written to\na file or variable.\n\n* SELECT INTO OUTFILE - formatting and writing the result to an external file.\n* SELECT INTO DUMPFILE - binary-safe writing of the unformatted results to an\nexternal file.\n* SELECT INTO Variable - selecting and setting variables.\n\nThe reverse of SELECT INTO OUTFILE is LOAD DATA.\n\nLIMIT\n-----\n\nRestricts the number of returned rows. See LIMIT and LIMIT ROWS EXAMINED for\ndetails.\n\nLOCK IN SHARE MODE/FOR UPDATE\n-----------------------------\n\nSee LOCK IN SHARE MODE and FOR UPDATE for details on the respective locking\nclauses.\n\nOFFSET ... FETCH\n----------------\n\nMariaDB starting with 10.6\n--------------------------\nSee SELECT ... OFFSET ... FETCH.\n\nORDER BY\n--------\n\nOrder a resultset. See ORDER BY for details.\n\nPARTITION\n---------\n\nSpecifies to the optimizer which partitions are relevant for the query. Other\npartitions will not be read. See Partition Pruning and Selection for details.\n\nPROCEDURE\n---------\n\nPasses the whole result set to a C Procedure. See PROCEDURE and PROCEDURE\nANALYSE (the only built-in procedure not requiring the server to be\nrecompiled).\n\nSKIP LOCKED\n-----------\n\nMariaDB starting with 10.6\n--------------------------\nThe SKIP LOCKED clause was introduced in MariaDB 10.6.0.\n\nThis causes those rows that couldn\'t be locked (LOCK IN SHARE MODE or FOR\nUPDATE) to be excluded from the result set. An explicit NOWAIT is implied\nhere. This is only implemented on InnoDB tables and ignored otherwise.\n\nSQL_CALC_FOUND_ROWS\n-------------------\n\nWhen SQL_CALC_FOUND_ROWS is used, then MariaDB will calculate how many rows\nwould have been in the result, if there would be no LIMIT clause. The result\ncan be found by calling the function FOUND_ROWS() in your next sql statement.\n\nmax_statement_time clause\n-------------------------\n\nBy using max_statement_time in conjunction with SET STATEMENT, it is possible\nto limit the execution time of individual queries. For example:\n\nSET STATEMENT max_statement_time=100 FOR \n SELECT field1 FROM table_name ORDER BY field1;\n\nWAIT/NOWAIT\n-----------\n\nSet the lock wait timeout. See WAIT and NOWAIT.\n\nExamples\n--------\n\nSELECT f1,f2 FROM t1 WHERE (f3<=10) AND (f4=\'y\');\n\nSee Getting Data from MariaDB (Beginner tutorial), or the various\nsub-articles, for more examples.\n\nURL: https://mariadb.com/kb/en/select/','','https://mariadb.com/kb/en/select/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (421,27,'JOIN Syntax','Description\n-----------\n\nMariaDB supports the following JOIN syntaxes for the table_references part of\nSELECT statements and multiple-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] [index_hint_list]\n | table_subquery [query_system_time_period_specification] [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 [join_condition]\n | table_reference STRAIGHT_JOIN table_factor\n | table_reference STRAIGHT_JOIN table_factor ON conditional_expr\n | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition\n | table_reference NATURAL [{LEFT|RIGHT} [OUTER]] JOIN table_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 allows to write\nqueries which involve multiple databases. See Identifier Qualifiers for syntax\ndetails.\n\nThe syntax of table_factor is extended in comparison with the SQL Standard.\nThe latter accepts only table_reference, not a list of them inside a pair of\nparentheses.\n\nThis is a conservative extension if we consider each comma in a list of\ntable_reference items as equivalent to an inner join. For example:\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 INNER JOIN (they can\nreplace each other). In standard SQL, they are not equivalent. INNER JOIN is\nused with an ON clause, CROSS JOIN is used otherwise.\n\nIn general, parentheses can be ignored in join expressions containing only\ninner join operations. MariaDB also supports nested joins (see\nhttp://dev.mysql.com/doc/refman/5.1/en/nested-join-optimization.html).\n\nSee System-versioned tables for more information about FOR SYSTEM_TIME syntax.\n\nIndex hints can be specified to affect how the MariaDB optimizer makes use of\nindexes. For more information, see How to force query plans.\n\nExamples\n--------\n\nSELECT left_tbl.*\n FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id = right_tbl.id\n WHERE right_tbl.id IS NULL;\n\nURL: https://mariadb.com/kb/en/join-syntax/','','https://mariadb.com/kb/en/join-syntax/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (422,27,'Scalar Subqueries','A scalar subquery is a subquery that returns a single value. This is the\nsimplest form of a subquery, and can be used in most places a literal or\nsingle column value is valid.\n\nThe data type, length and character set and collation are all taken from the\nresult returned by the subquery. The result of a subquery can always be NULL,\nthat is, no result returned. Even if the original value is defined as NOT\nNULL, this is disregarded.\n\nA subquery cannot be used where only a literal is expected, for example LOAD\nDATA INFILE expects a literal string containing the file name, and LIMIT\nrequires a literal integer.\n\nExamples\n--------\n\nCREATE TABLE sq1 (num TINYINT);\n\nCREATE TABLE sq2 (num TINYINT);\n\nINSERT INTO sq1 VALUES (1);\n\nINSERT INTO sq2 VALUES (10* (SELECT num FROM sq1));\n\nSELECT * FROM sq2;\n+------+\n| num |\n+------+\n| 10 |\n+------+\n\nInserting a second row means the subquery is no longer a scalar, and this\nparticular query is not valid:\n\nINSERT INTO sq1 VALUES (2);\n\nINSERT INTO sq2 VALUES (10* (SELECT num FROM sq1));\nERROR 1242 (21000): Subquery returns more than 1 row\n\nNo rows in the subquery, so the scalar is NULL:\n\nINSERT INTO sq2 VALUES (10* (SELECT num FROM sq3 WHERE num=\'3\'));\n\nSELECT * FROM sq2;\n+------+\n| num |\n+------+\n| 10 |\n| NULL |\n+------+\n\nA more traditional scalar subquery, as part of a WHERE clause:\n\nSELECT * FROM sq1 WHERE num = (SELECT MAX(num)/10 FROM sq2); \n+------+\n| num |\n+------+\n| 1 |\n+------+\n\nURL: https://mariadb.com/kb/en/subqueries-scalar-subqueries/','','https://mariadb.com/kb/en/subqueries-scalar-subqueries/'); @@ -526,20 +523,20 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (428,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 (429,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 (430,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 (431,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 (431,27,'EXCEPT','The 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 when SQL_MODE=ORACLE is\nset.\n\nSyntax\n------\n\nSELECT ...\n(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) \n SELECT ...\n[(INTERSECT [ALL | DISTINCT] | EXCEPT [ALL | DISTINCT] | UNION [ALL |\nDISTINCT]) \n SELECT ...]\n[ORDER BY [{col_name | expr | position} [ASC | DESC] \n [, {col_name | expr | position} [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 (432,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 (433,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 (434,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 (435,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 (436,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 (437,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 (438,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 (439,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,'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\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 (439,27,'Recursive Common Table Expressions Overview','Common 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 (440,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 (441,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 (442,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 (443,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 (444,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 (444,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 default), the LOCK IN SHARE MODE and FOR UPDATE\nclauses have no 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 (445,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 (446,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 (447,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/'); @@ -547,12 +544,12 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (449,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 (450,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 (451,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 (452,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 (453,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,'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|ROWS}]\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 mariadb-dump -T or with the SELECT INTO OUTFILE\nstatement with the mariadb 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\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 you can compress the file using the --compress option, to\nget better performance over slow networks, providing both the client and\nserver support the compressed protocol. Use the --local option to load from\nthe 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 (453,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 mariadb client in XML output\nmode (that is, starting the client with the --xml option). To write data from\na table to an XML file, use a command such as the following one from the\nsystem shell:\n\nshell> mariadb --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 mariadb-dump.\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 allows 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 (454,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 (455,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 (456,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 (457,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 (457,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\nInvalid values are changed to the closest valid value and inserted, with a\nwarning produced.\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\nSee IGNORE for a full description of effects.\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+------+\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\nConverting values:\n\nCREATE OR REPLACE TABLE t2(id INT, t VARCHAR(2) NOT NULL, n INT NOT NULL);\n\nINSERT INTO t2(id) VALUES (1),(2);\nERROR 1364 (HY000): Field \'t\' doesn\'t have a default value\n\nINSERT IGNORE INTO t2(id) VALUES (1),(2);\nQuery OK, 2 rows affected, 2 warnings (0.026 sec)\nRecords: 2 Duplicates: 0 Warnings: 2\n\nSHOW WARNINGS;\n+---------+------+----------------------------------------+\n| Level | Code | Message |\n+---------+------+----------------------------------------+\n| Warning | 1364 | Field \'t\' doesn\'t have a default value |\n| Warning | 1364 | Field \'n\' doesn\'t have a default value |\n+---------+------+----------------------------------------+\n\nSELECT * FROM t2;\n+------+---+---+\n| id | t | n |\n+------+---+---+\n| 1 | | 0 |\n| 2 | | 0 |\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 (458,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 (459,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 (460,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/'); @@ -562,7 +559,7 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (464,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 (465,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 (466,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 (467,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 to allow one to analyze a query currently running in another\nconnection.\n\nData About Individual Query Plan Nodes\n--------------------------------------\n\n* filesort node reports whether sorting was done with LIMIT n parameter, and\nhow many rows were in the sort result. \n* block-nl-join node has r_loops field, which allows to tell whether Using\njoin buffer was efficient \n* range-checked-for-each-record reports counters that show the result of the\ncheck. \n* expression-cache is used for subqueries, and it reports how many times the\ncache was used, and what cache hit ratio was.\n* union_result node has r_rows so one can see how many rows were produced\nafter UNION operation\n* and so forth\n\nUse Cases\n---------\n\nSee Examples of ANALYZE FORMAT=JSON.\n\nURL: https://mariadb.com/kb/en/analyze-format-json/','','https://mariadb.com/kb/en/analyze-format-json/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (468,28,'ANALYZE FORMAT=JSON Examples','Example #1\n----------\n\nCustomers who have ordered more than 1M goods.\n\nANALYZE FORMAT=JSON\nSELECT COUNT(*)\nFROM customer\nWHERE\n (SELECT SUM(o_totalprice) FROM orders WHERE o_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 * 1000)))\",\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, which was executed\n150K times (for every row of outer table).\n\nURL: https://mariadb.com/kb/en/analyze-formatjson-examples/','','https://mariadb.com/kb/en/analyze-formatjson-examples/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (469,28,'ANALYZE Statement','Description\n-----------\n\nThe ANALYZE statement is similar to the EXPLAIN statement. ANALYZE statement\nwill invoke the optimizer, execute the statement, and then produce EXPLAIN\noutput instead of the result set. The EXPLAIN output will be annotated with\nstatistics from statement execution.\n\nThis lets one check how close the optimizer\'s estimates about the query plan\nare to the reality. ANALYZE produces an overview, while the ANALYZE\nFORMAT=JSON command provides a more detailed view of the query plan and the\nquery execution.\n\nThe syntax is\n\nANALYZE explainable_statement;\n\nwhere the statement is any statement for which one can run EXPLAIN.\n\nCommand Output\n--------------\n\nConsider an example:\n\nANALYZE SELECT * FROM tbl1 \nWHERE key1 \n BETWEEN 10 AND 200 AND\n col1 LIKE \'foo%\'\\G\n\n*************************** 1. row ***************************\n id: 1\n select_type: SIMPLE\n table: tbl1\n type: range\npossible_keys: key1\n key: key1\n key_len: 5\n ref: NULL\n rows: 181\n r_rows: 181\n filtered: 100.00\n r_filtered: 10.50\n Extra: Using index condition; Using where\n\nCompared to EXPLAIN, ANALYZE produces two extra columns:\n\n* r_rows is an observation-based counterpart of the rows column. It shows how\nmany rows were actually read from the table. \n* r_filtered is an observation-based counterpart of the filtered column. It\nshows which fraction of rows was left after applying the WHERE condition.\n\nInterpreting the Output\n-----------------------\n\nJoins\n-----\n\nLet\'s consider a more complicated example.\n\nANALYZE SELECT *\nFROM orders, customer \nWHERE\n customer.c_custkey=orders.o_custkey AND\n customer.c_acctbal < 0 AND\n orders.o_totalprice > 200*1000\n\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n| id | select_type | table | type | possible_keys | key | key_len |\nref | rows | r_rows | filtered | r_filtered | Extra |\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n| 1 | SIMPLE | customer | ALL | PRIMARY,... | NULL | NULL |\nNULL | 149095 | 150000 | 18.08 | 9.13 | Using where |\n| 1 | SIMPLE | orders | ref | i_o_custkey | i_o_custkey | 5 |\ncustomer.c_custkey | 7 | 10 | 100.00 | 30.03 | Using where |\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n\nHere, one can see that\n\n* For table customer, customer.rows=149095, customer.r_rows=150000. The\nestimate for number of rows we will read was fairly precise\n* customer.filtered=18.08, customer.r_filtered=9.13. The optimizer somewhat\noverestimated the number of records that will match selectivity of condition\nattached to `customer` table (in general, when you have a full scan and\nr_filtered is less than 15%, it\'s time to consider adding an appropriate\nindex).\n* For table orders, orders.rows=7, orders.r_rows=10. This means that on\naverage, there are 7 orders for a given c_custkey, but in our case there were\n10, which is close to the expectation (when this number is consistently far\nfrom the expectation, it may be time to run ANALYZE TABLE, or even edit the\ntable statistics manually to get better query plans).\n* orders.filtered=100, orders.r_filtered=30.03. The optimizer didn\'t have any\nway to estimate which fraction of records will be left after it checks the\ncondition that is attached to table orders (it\'s orders.o_totalprice >\n200*1000). So, it used 100%. In reality, it is 30%. 30% is typically not\nselective enough to warrant adding new indexes. For joins with many tables, it\nmight be worth to collect and use column statistics for columns in question,\nthis may help the optimizer to pick a better query plan.\n\nMeaning of NULL in r_rows and r_filtered\n----------------------------------------\n\nLet\'s modify the previous example slightly\n\nANALYZE SELECT * \nFROM orders, customer \nWHERE\n customer.c_custkey=orders.o_custkey AND\n customer.c_acctbal < -0 AND\n customer.c_comment LIKE \'%foo%\' AND\n orders.o_totalprice > 200*1000;\n\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n| id | select_type | table | type | possible_keys | key | key_len |\nref | rows | r_rows | filtered | r_filtered | Extra |\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n| 1 | SIMPLE | customer | ALL | PRIMARY,... | NULL | NULL |\nNULL | 149095 | 150000 | 18.08 | 0.00 | Using where |\n| 1 | SIMPLE | orders | ref | i_o_custkey | i_o_custkey | 5 |\ncustomer.c_custkey | 7 | NULL | 100.00 | NULL | Using where |\n+----+-------------+----------+------+---------------+-------------+---------+-\n------------------+--------+--------+----------+------------+-------------+\n\nHere, one can see that orders.r_rows=NULL and orders.r_filtered=NULL. This\nmeans that table orders was not scanned even once. Indeed, we can also see\ncustomer.r_filtered=0.00. This shows that a part of WHERE attached to table\n`customer` was never satisfied (or, satisfied in less than 0.01% of cases).\n\nANALYZE FORMAT=JSON\n-------------------\n\nANALYZE FORMAT=JSON produces JSON output. It produces much more information\nthan tabular ANALYZE.\n\nNotes\n-----\n\n* ANALYZE UPDATE or ANALYZE DELETE will actually make updates/deletes (ANALYZE\nSELECT will perform the select operation and then discard the resultset).\n* PostgreSQL has a similar command, EXPLAIN ANALYZE.\n* The EXPLAIN in the slow query log feature allows MariaDB to have ANALYZE\noutput of slow queries printed into the slow query log (see MDEV-6388).\n\nURL: https://mariadb.com/kb/en/analyze-statement/','','https://mariadb.com/kb/en/analyze-statement/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (470,28,'EXPLAIN','Syntax\n------\n\nEXPLAIN tbl_name [col_name | wild]\n\nOr\n\nEXPLAIN [EXTENDED | PARTITIONS | FORMAT=JSON] \n {SELECT select_options | UPDATE update_options | DELETE delete_options}\n\nDescription\n-----------\n\nThe EXPLAIN statement can be used either as a synonym for DESCRIBE or as a way\nto obtain information about how MariaDB executes a SELECT, UPDATE or DELETE\nstatement:\n\n* \'EXPLAIN tbl_name\' is synonymous with \n \'DESCRIBE tbl_name\' or\n \'SHOW COLUMNS FROM tbl_name\'.\n* When you precede a SELECT, UPDATE or a DELETE statement with the keyword \n EXPLAIN, MariaDB displays information from the optimizer\n about the query execution plan. That is, MariaDB explains how it would\n process the SELECT, UPDATE or DELETE, including information about how tables\n are joined and in which order. EXPLAIN EXTENDED can be\n used to provide additional information.\n* EXPLAIN PARTITIONS is useful only when examining queries involving\npartitioned tables. For details, see Partition pruning and selection.\n* ANALYZE statement performs the query as well as producing EXPLAIN output,\nand provides actual as well as estimated statistics.\n* EXPLAIN output can be printed in the slow query log. See EXPLAIN in the Slow\nQuery Log for details.\n\nSHOW EXPLAIN shows the output of a running statement. In some cases, its\noutput can be closer to reality than EXPLAIN.\n\nThe ANALYZE statement runs a statement and returns information about its\nexecution plan. It also shows additional columns, to check how much the\noptimizer\'s estimation about filtering and found rows are close to reality.\n\nThere is an online EXPLAIN Analyzer that you can use to share EXPLAIN and\nEXPLAIN EXTENDED output with others.\n\nEXPLAIN can acquire metadata locks in the same way that SELECT does, as it\nneeds to know table metadata and, sometimes, data as well.\n\nColumns in EXPLAIN ... SELECT\n-----------------------------\n\n+--------------------------------------+--------------------------------------+\n| Column name | Description |\n+--------------------------------------+--------------------------------------+\n| id | Sequence number that shows in which |\n| | order tables are joined. |\n+--------------------------------------+--------------------------------------+\n| select_type | What kind of SELECT the table comes |\n| | from. |\n+--------------------------------------+--------------------------------------+\n| table | Alias name of table. Materialized |\n| | temporary tables for sub queries |\n| | are named |\n+--------------------------------------+--------------------------------------+\n| type | How rows are found from the table |\n| | (join type). |\n+--------------------------------------+--------------------------------------+\n| possible_keys | keys in table that could be used to |\n| | find rows in the table |\n+--------------------------------------+--------------------------------------+\n| key | The name of the key that is used to |\n| | retrieve rows. NULL is no key was |\n| | used. |\n+--------------------------------------+--------------------------------------+\n| key_len | How many bytes of the key that was |\n| | used (shows if we are using only |\n| | parts of the multi-column key). |\n+--------------------------------------+--------------------------------------+\n| ref | The reference that is used as the |\n| | key value. |\n+--------------------------------------+--------------------------------------+\n| rows | An estimate of how many rows we |\n| | will find in the table for each key |\n| | lookup. |\n+--------------------------------------+--------------------------------------+\n| Extra | Extra information about this join. |\n+--------------------------------------+--------------------------------------+\n\nHere are descriptions of the values for some of the more complex columns in\nEXPLAIN ... SELECT:\n\n\"Select_type\" Column\n--------------------\n\nThe select_type column can have the following values:\n\n+-----------------+-----------------------------------+-----------------------+\n| Value | Description | Comment |\n+-----------------+-----------------------------------+-----------------------+\n| DEPENDENT | The SUBQUERY is DEPENDENT. | |\n| SUBQUERY | | |\n+-----------------+-----------------------------------+-----------------------+\n| DEPENDENT UNION | The UNION is DEPENDENT. | |\n+-----------------+-----------------------------------+-----------------------+\n| DERIVED | The SELECT is DERIVED from the | |\n| | PRIMARY. | |\n+-----------------+-----------------------------------+-----------------------+\n| MATERIALIZED | The SUBQUERY is MATERIALIZED. | Materialized tables |\n| | | will be populated at |\n| | | first access and |\n| | | will be accessed by |\n| | | the primary key (= |\n| | | one key lookup). |\n| | | Number of rows in |\n| | | EXPLAIN shows the |\n| | | cost of populating |\n| | | the table |\n+-----------------+-----------------------------------+-----------------------+\n| PRIMARY | The SELECT is in the outermost | |\n| | query, but there is also a | |\n| | SUBQUERY within it. | |\n+-----------------+-----------------------------------+-----------------------+\n| SIMPLE | It is a simple SELECT query | |\n| | without any SUBQUERY or UNION. | |\n+-----------------+-----------------------------------+-----------------------+\n| SUBQUERY | The SELECT is a SUBQUERY of the | |\n| | PRIMARY. | |\n+-----------------+-----------------------------------+-----------------------+\n| UNCACHEABLE | The SUBQUERY is UNCACHEABLE. | |\n| SUBQUERY | | |\n+-----------------+-----------------------------------+-----------------------+\n| UNCACHEABLE | The UNION is UNCACHEABLE. | |\n| UNION | | |\n+-----------------+-----------------------------------+-----------------------+\n| UNION | The SELECT is a UNION of the | |\n| | PRIMARY. | |\n+-----------------+-----------------------------------+-----------------------+\n| UNION RESULT | The result of the UNION. | |\n+-----------------+-----------------------------------+-----------------------+\n| LATERAL DERIVED | The SELECT uses a Lateral | |\n| | Derived optimization | |\n+-----------------+-----------------------------------+-----------------------+\n\n\"Type\" Column\n-------------\n\nThis column contains information on how the table is accessed.\n\n+------------------------+---------------------------------------------------+\n| Value | Description |\n+------------------------+---------------------------------------------------+\n| ALL | A full table scan is done for the table (all |\n| | rows are read). This is bad if the table is |\n| | large and the table is joined against a previous |\n| | table! This happens when the optimizer could |\n| | not find any usable index to access rows. |\n+------------------------+---------------------------------------------------+\n| const | There is only one possibly matching row in the |\n| | table. The row is read before the optimization |\n| | phase and all columns in the table are treated |\n| | as constants. |\n+------------------------+---------------------------------------------------+\n| eq_ref | A unique index is used to find the rows. This is |\n| | the best possible plan to find the row. |\n+------------------------+---------------------------------------------------+\n| fulltext | A fulltext index is used to access the rows. |\n+------------------------+---------------------------------------------------+\n| index_merge | A \'range\' access is done for for several index |\n| | and the found rows are merged. The key column |\n| | shows which keys are used. |\n+------------------------+---------------------------------------------------+\n| index_subquery | This is similar as ref, but used for sub queries |\n| | that are transformed to key lookups. |\n+------------------------+---------------------------------------------------+\n| index | A full scan over the used index. Better than |\n| | ALL but still bad if index is large and the |\n| | table is joined against a previous table. |\n+------------------------+---------------------------------------------------+\n| range | The table will be accessed with a key over one |\n| | or more value ranges. |\n+------------------------+---------------------------------------------------+\n| ref_or_null | Like \'ref\' but in addition another search for |\n| | the \'null\' value is done if the first value was |\n| | not found. This happens usually with sub queries. |\n+------------------------+---------------------------------------------------+\n| ref | A non unique index or prefix of an unique index |\n| | is used to find the rows. Good if the prefix |\n| | doesn\'t match many rows. |\n+------------------------+---------------------------------------------------+\n| system | The table has 0 or 1 rows. |\n+------------------------+---------------------------------------------------+\n| unique_subquery | This is similar as eq_ref, but used for sub |\n| | queries that are transformed to key lookups |\n+------------------------+---------------------------------------------------+\n\n\"Extra\" Column\n--------------\n\nThis column consists of one or more of the following values, separated by \';\'\n\nNote that some of these values are detected after the optimization phase.\n\nThe optimization phase can do the following changes to the WHERE clause:\n\n* Add the expressions from the ON and USING clauses to the WHERE\n clause.\n* Constant propagation: If there is column=constant, replace all column\n instances with this constant.\n* Replace all columns from \'const\' tables with their values.\n* Remove the used key columns from the WHERE (as this will be tested as\n part of the key lookup).\n* Remove impossible constant sub expressions.\n For example WHERE \'(a=1 and a=2) OR b=1\' becomes \'b=1\'.\n* Replace columns with other columns that has identical values:\n Example: WHERE a=b and a=c may be treated\n as \'WHERE a=b and a=c and b=c\'.\n* Add extra conditions to detect impossible row conditions earlier. This\n happens mainly with OUTER JOIN where we in some cases add detection\n of NULL values in the WHERE (Part of \'Not exists\' optimization).\n This can cause an unexpected \'Using where\' in the Extra column.\n* For each table level we remove expressions that have already been tested when\n we read the previous row. Example: When joining tables t1 with t2\n using the following WHERE \'t1.a=1 and t1.a=t2.b\', we don\'t have to\n test \'t1.a=1\' when checking rows in t2 as we already know that this\n expression is true.\n\n+------------------------+---------------------------------------------------+\n| Value | Description |\n+------------------------+---------------------------------------------------+\n| const row not found | The table was a system table (a table with |\n| | should exactly one row), but no row was found. |\n+------------------------+---------------------------------------------------+\n| Distinct | If distinct optimization (remove duplicates) was |','','https://mariadb.com/kb/en/explain/'); @@ -572,7 +569,7 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (472,28,'EXPLAIN FORMAT=JSON','Synopsis\n--------\n\nEXPLAIN FORMAT=JSON is a variant of EXPLAIN command that produces output in\nJSON form. The output always has one row which has only one column titled\n\"JSON\". The contents are a JSON representation of the query plan, formatted\nfor readability:\n\nEXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE col1=1\\G\n\n*************************** 1. row ***************************\nEXPLAIN: {\n \"query_block\": {\n \"select_id\": 1,\n \"table\": {\n \"table_name\": \"t1\",\n \"access_type\": \"ALL\",\n \"rows\": 1000,\n \"filtered\": 100,\n \"attached_condition\": \"(t1.col1 = 1)\"\n }\n }\n}\n\nOutput is different from MySQL\n------------------------------\n\nThe output of MariaDB\'s EXPLAIN FORMAT=JSON is different from EXPLAIN\nFORMAT=JSON in MySQL.The reasons for that are:\n\n* MySQL\'s output has deficiencies. Some are listed here: EXPLAIN FORMAT=JSON\nin MySQL\n* The output of MySQL\'s EXPLAIN FORMAT=JSON is not defined. Even MySQL\nWorkbench has trouble parsing it (see this blog post).\n* MariaDB has query optimizations that MySQL does not have. Ergo, MariaDB\ngenerates query plans that MySQL does not generate.\n\nA (as yet incomplete) list of how MariaDB\'s output is different from MySQL can\nbe found here: EXPLAIN FORMAT=JSON differences from MySQL.\n\nOutput Format\n-------------\n\nTODO: MariaDB\'s output format description.\n\nURL: https://mariadb.com/kb/en/explain-format-json/','','https://mariadb.com/kb/en/explain-format-json/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (473,28,'DESCRIBE','Syntax\n------\n\n{DESCRIBE | DESC} tbl_name [col_name | wild]\n\nDescription\n-----------\n\nDESCRIBE provides information about the columns in a table. It is a shortcut\nfor SHOW COLUMNS FROM. These statements also display information for views.\n\ncol_name can be a column name, or a string containing the SQL \"%\" and \"_\"\nwildcard characters to obtain output only for the columns with names matching\nthe string. There is no need to enclose the string within quotes unless it\ncontains spaces or other special characters.\n\nDESCRIBE city;\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 more information about the output\ncolumns.\n\nURL: https://mariadb.com/kb/en/describe/','','https://mariadb.com/kb/en/describe/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (474,29,'Identifier Names','Databases, tables, indexes, columns, aliases, views, stored routines,\ntriggers, events, variables, partitions, tablespaces, savepoints, labels,\nusers, roles, are collectively known as identifiers, and have certain rules\nfor naming.\n\nIdentifiers may be quoted using the backtick character - `. Quoting is\noptional for identifiers that don\'t contain special characters, or for\nidentifiers that are not reserved words. If the ANSI_QUOTES SQL_MODE flag is\nset, double quotes (\") can also be used to quote identifiers. If the MSSQL\nflag is set, square brackets ([ and ]) can be used for quoting.\n\nEven when using reserved words as names, fully qualified names do not need to\nbe quoted. For example, test.select has only one possible meaning, so it is\ncorrectly parsed even without quotes.\n\nUnquoted\n--------\n\nThe following characters are valid, and allow identifiers to be unquoted:\n\n* ASCII: [0-9,a-z,A-Z$_] (numerals 0-9, basic Latin letters, both lowercase\nand uppercase, dollar sign, underscore)\n* Extended: U+0080 .. U+FFFF\n\nQuoted\n------\n\nThe following characters are valid, but identifiers using them must be quoted:\n\n* ASCII: U+0001 .. U+007F (full Unicode Basic Multilingual Plane (BMP) except\nfor U+0000)\n* Extended: U+0080 .. U+FFFF \n* Identifier quotes can themselves be used as part of an identifier, as long\nas they are quoted.\n\nFurther Rules\n-------------\n\nThere are a number of other rules for identifiers:\n\n* Identifiers are stored as Unicode (UTF-8)\n* Identifiers may or may not be case-sensitive. See Indentifier\nCase-sensitivity.\n* Database, table and column names can\'t end with space characters\n* Identifier names may begin with a numeral, but can\'t only contain numerals\nunless quoted.\n* An identifier starting with a numeral, followed by an \'e\', may be parsed as\na floating point number, and needs to be quoted.\n* Identifiers are not permitted to contain the ASCII NUL character (U+0000)\nand supplementary characters (U+10000 and higher).\n* Names such as 5e6, 9e are not prohibited, but it\'s strongly recommended not\nto use them, as they could lead to ambiguity in certain contexts, being\ntreated as a number or expression.\n* User variables cannot be used as part of an identifier, or as an identifier\nin an SQL statement.\n\nQuote Character\n---------------\n\nThe regular quote character is the backtick character - `, but if the\nANSI_QUOTES SQL_MODE option is specified, a regular double quote - \" may be\nused as well.\n\nThe backtick character can be used as part of an identifier. In that case the\nidentifier needs to be quoted. The quote character can be the backtick, but in\nthat case, the backtick in the name must be escaped with another backtick.\n\nMaximum Length\n--------------\n\n* Databases, tables, columns, indexes, constraints, stored routines, triggers,\nevents, views, tablespaces, servers and log file groups have a maximum length\nof 64 characters.\n* Compound statement labels have a maximum length of 16 characters\n* Aliases have a maximum length of 256 characters, except for column aliases\nin CREATE VIEW statements, which are checked against the maximum column length\nof 64 characters (not the maximum alias length of 256 characters).\n* Users have a maximum length of 80 characters.\n* Roles have a maximum length of 128 characters.\n* Multi-byte characters do not count extra towards towards the character limit.\n\nMultiple Identifiers\n--------------------\n\nMariaDB allows the column name to be used on its own if the reference will be\nunambiguous, or the table name to be used with the column name, or all three\nof the database, table and column names. A period is used to separate the\nidentifiers, and the period can be surrounded by spaces.\n\nExamples\n--------\n\nUsing the period to separate identifiers:\n\nCREATE TABLE t1 (i int);\n\nINSERT INTO t1(i) VALUES (10);\n\nSELECT i FROM t1;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nSELECT t1.i FROM t1;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nSELECT test.t1.i FROM t1;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nThe period can be separated by spaces:\n\nSELECT test . t1 . i FROM t1;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nResolving ambiguity:\n\nCREATE TABLE t2 (i int);\n\nSELECT i FROM t1 LEFT JOIN t2 ON t1.i=t2.i;\nERROR 1052 (23000): Column \'i\' in field list is ambiguous\n\nSELECT t1.i FROM t1 LEFT JOIN t2 ON t1.i=t2.i;\n+------+\n| i |\n+------+\n| 10 |\n+------+\n\nCreating a table with characters that require quoting:\n\nCREATE TABLE 123% (i int);\nERROR 1064 (42000): You have an error in your SQL syntax; \n check the manual that corresponds to your MariaDB server version for the\nright syntax \n to use near \'123% (i int)\' at line 1\n\nCREATE TABLE `123%` (i int);\nQuery OK, 0 rows affected (0.85 sec)\n\nCREATE TABLE `TABLE` (i int);\nQuery OK, 0 rows affected (0.36 sec)\n\nUsing double quotes as a quoting character:\n\nCREATE TABLE \"SELECT\" (i int);\nERROR 1064 (42000): You have an error in your SQL syntax; \n check the manual that corresponds to your MariaDB server version for the\nright syntax \n to use near \'\"SELECT\" (i int)\' at line 1\n\nSET sql_mode=\'ANSI_QUOTES\';\nQuery OK, 0 rows affected (0.03 sec)\n\nCREATE TABLE \"SELECT\" (i int);\nQuery OK, 0 rows affected (0.46 sec)\n\nUsing an identifier quote as part of an identifier name:\n\nSHOW VARIABLES LIKE \'sql_mode\';\n+---------------+-------------+\n| Variable_name | Value |\n+---------------+-------------+\n| sql_mode | ANSI_QUOTES |\n+---------------+-------------+\n\nCREATE TABLE \"fg`d\" (i int);\nQuery OK, 0 rows affected (0.34 sec)\n\nCreating the table named * (Unicode number: U+002A) requires quoting.\n\nCREATE TABLE `*` (a INT);\n\nFloating point ambiguity:\n\nCREATE TABLE 8984444cce5d (x INT);\nQuery OK, 0 rows affected (0.38 sec)\n\nCREATE TABLE 8981e56cce5d (x INT);\nERROR 1064 (42000): You have an error in your SQL syntax; \n check the manual that corresponds to your MariaDB server version for the\nright syntax \n to use near \'8981e56cce5d (x INT)\' at line 1\n\nCREATE TABLE `8981e56cce5d` (x INT);\nQuery OK, 0 rows affected (0.39 sec)\n\nURL: https://mariadb.com/kb/en/identifier-names/','','https://mariadb.com/kb/en/identifier-names/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (475,29,'Identifier Case-sensitivity','Whether objects are case-sensitive or not is partly determined by the\nunderlying operating system. Unix-based systems are case-sensitive, Windows is\nnot, while Mac OS X is usually case-insensitive by default, but devices can be\nconfigured as case-sensitive using Disk Utility.\n\nDatabase, table, table aliases and trigger names are affected by the systems\ncase-sensitivity, while index, column, column aliases, stored routine and\nevent names are never case sensitive.\n\nLog file group name are case sensitive.\n\nThe lower_case_table_names server system variable plays a key role. It\ndetermines whether table names, aliases and database names are compared in a\ncase-sensitive manner. If set to 0 (the default on Unix-based systems), table\nnames and aliases and database names are compared in a case-sensitive manner.\nIf set to 1 (the default on Windows), names are stored in lowercase and not\ncompared in a case-sensitive manner. If set to 2 (the default on Mac OS X),\nnames are stored as declared, but compared in lowercase.\n\nIt is thus possible to make Unix-based systems behave like Windows and ignore\ncase-sensitivity, but the reverse is not true, as the underlying Windows\nfilesystem can not support this.\n\nEven on case-insensitive systems, you are required to use the same case\nconsistently within the same statement. The following statement fails, as it\nrefers to the table name in a different case.\n\nSELECT * FROM a_table WHERE A_table.id>10;\n\nFor a full list of identifier naming rules, see Identifier Names.\n\nPlease note that lower_case_table_names is a database initialization\nparameter. This means that, along with innodb_page_size, this variable must be\nset before running mysql_install_db, and will not change the behavior of\nservers unless applied before the creation of core system databases.\n\nURL: https://mariadb.com/kb/en/identifier-case-sensitivity/','','https://mariadb.com/kb/en/identifier-case-sensitivity/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (475,29,'Identifier Case-sensitivity','Whether objects are case-sensitive or not is partly determined by the\nunderlying operating system. Unix-based systems are case-sensitive, Windows is\nnot, while Mac OS X is usually case-insensitive by default, but devices can be\nconfigured as case-sensitive using Disk Utility.\n\nDatabase, table, table aliases and trigger names are affected by the systems\ncase-sensitivity, while index, column, column aliases, stored routine and\nevent names are never case sensitive.\n\nLog file group name are case sensitive.\n\nThe lower_case_table_names server system variable plays a key role. It\ndetermines whether table names, aliases and database names are compared in a\ncase-sensitive manner. If set to 0 (the default on Unix-based systems), table\nnames and aliases and database names are compared in a case-sensitive manner.\nIf set to 1 (the default on Windows), names are stored in lowercase and not\ncompared in a case-sensitive manner. If set to 2 (the default on Mac OS X),\nnames are stored as declared, but compared in lowercase.\n\nIt is thus possible to make Unix-based systems behave like Windows and ignore\ncase-sensitivity, but the reverse is not true, as the underlying Windows\nfilesystem can not support this.\n\nEven on case-insensitive systems, you are required to use the same case\nconsistently within the same statement. The following statement fails, as it\nrefers to the table name in a different case.\n\nSELECT * FROM a_table WHERE A_table.id>10;\n\nFor a full list of identifier naming rules, see Identifier Names.\n\nPlease note that lower_case_table_names is a database initialization\nparameter. This means that, along with innodb_page_size, this variable must be\nset before running mariadb-install-db, and will not change the behavior of\nservers unless applied before the creation of core system databases.\n\nURL: https://mariadb.com/kb/en/identifier-case-sensitivity/','','https://mariadb.com/kb/en/identifier-case-sensitivity/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (476,29,'Binary Literals','Binary literals can be written in one of the following formats: b\'value\',\nB\'value\' or 0bvalue, where value is a string composed by 0 and 1 digits.\n\nBinary literals are interpreted as binary strings, and are convenient to\nrepresent VARBINARY, BINARY or BIT values.\n\nTo convert a binary literal into an integer, just add 0.\n\nExamples\n--------\n\nPrinting the value as a binary string:\n\nSELECT 0b1000001;\n+-----------+\n| 0b1000001 |\n+-----------+\n| A |\n+-----------+\n\nConverting the same value into a number:\n\nSELECT 0b1000001+0;\n+-------------+\n| 0b1000001+0 |\n+-------------+\n| 65 |\n+-------------+\n\nURL: https://mariadb.com/kb/en/binary-literals/','','https://mariadb.com/kb/en/binary-literals/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (477,29,'Boolean Literals','In MariaDB, FALSE is a synonym of 0 and TRUE is a synonym of 1. These\nconstants are case insensitive, so TRUE, True, and true are equivalent.\n\nThese terms are not synonyms of 0 and 1 when used with the IS operator. So,\nfor example, 10 IS TRUE returns 1, while 10 = TRUE returns 0 (because 1 != 10).\n\nThe IS operator accepts a third constant exists: UNKNOWN. It is always a\nsynonym of NULL.\n\nTRUE and FALSE are reserved words, while UNKNOWN is not.\n\nURL: https://mariadb.com/kb/en/sql-language-structure-boolean-literals/','','https://mariadb.com/kb/en/sql-language-structure-boolean-literals/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (478,29,'Date and Time Literals','Standard syntaxes\n-----------------\n\nMariaDB supports the SQL standard and ODBC syntaxes for DATE, TIME and\nTIMESTAMP literals.\n\nSQL standard syntax:\n\n* DATE \'string\'\n* TIME \'string\'\n* TIMESTAMP \'string\'\n\nODBC syntax:\n\n* {d \'string\'}\n* {t \'string\'}\n* {ts \'string\'}\n\nThe timestamp literals are treated as DATETIME literals, because in MariaDB\nthe range of DATETIME is closer to the TIMESTAMP range in the SQL standard.\n\nstring is a string in a proper format, as explained below.\n\nDATE literals\n-------------\n\nA DATE string is a string in one of the following formats: \'YYYY-MM-DD\' or\n\'YY-MM-DD\'. Note that any punctuation character can be used as delimiter. All\ndelimiters must consist of 1 character. Different delimiters can be used in\nthe same string. Delimiters are optional (but if one delimiter is used, all\ndelimiters must be used).\n\nA DATE literal can also be an integer, in one of the following formats:\nYYYYMMDD or YYMMDD.\n\nAll the following DATE literals are valid, and they all represent the same\nvalue:\n\n\'19940101\'\n\'940101\'\n\'1994-01-01\'\n\'94/01/01\'\n\'1994-01/01\'\n\'94:01!01\'\n19940101\n940101\n\nDATETIME literals\n-----------------\n\nA DATETIME string is a string in one of the following formats: \'YYYY-MM-DD\nHH:MM:SS\' or \'YY-MM-DD HH:MM:SS\'. Note that any punctuation character can be\nused as delimiter for the date part and for the time part. All delimiters must\nconsist of 1 character. Different delimiters can be used in the same string.\nThe hours, minutes and seconds parts can consist of one character. For this\nreason, delimiters are mandatory for DATETIME literals.\n\nThe delimiter between the date part and the time part can be a T or any\nsequence of space characters (including tabs, new lines and carriage returns).\n\nA DATETIME literal can also be a number, in one of the following formats:\nYYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD or YYMMDD. In this case, all the time\nsubparts must consist of 2 digits.\n\nAll the following DATE literals are valid, and they all represent the same\nvalue:\n\n\'1994-01-01T12:30:03\'\n\'1994/01/01\\n\\t 12+30+03\'\n\'1994/01\\\\01\\n\\t 12+30-03\'\n\'1994-01-01 12:30:3\'\n\nTIME literals\n-------------\n\nA TIME string is a string in one of the following formats: \'D HH:MM:SS\',\n\'HH:MM:SS, \'D HH:MM\', \'HH:MM\', \'D HH\', or \'SS\'. D is a value from 0 to 34\nwhich represents days. : is the only allowed delimiter for TIME literals.\nDelimiters are mandatory, with an exception: the \'HHMMSS\' format is allowed.\nWhen delimiters are used, each part of the literal can consist of one\ncharacter.\n\nA TIME literal can also be a number in one of the following formats: HHMMSS,\nMMSS, or SS.\n\nThe following literals are equivalent:\n\n\'09:05:00\'\n\'9:05:0\'\n\'9:5:0\'\n\'090500\'\n\n2-digit years\n-------------\n\nThe year part in DATE and DATETIME literals is determined as follows:\n\n* 70 - 99 = 1970 - 1999\n* 00 - 69 = 2000 - 2069\n\nMicroseconds\n------------\n\nDATETIME and TIME literals can have an optional microseconds part. For both\nstring and numeric forms, it is expressed as a decimal part. Up to 6 decimal\ndigits are allowed. Examples:\n\n\'12:30:00.123456\'\n123000.123456\n\nSee Microseconds in MariaDB for details.\n\nDate and time literals and the SQL_MODE\n---------------------------------------\n\nUnless the SQL_MODE NO_ZERO_DATE flag is set, some special values are allowed:\nthe \'0000-00-00\' DATE, the \'00:00:00\' TIME, and the 0000-00-00 00:00:00\nDATETIME.\n\nIf the ALLOW_INVALID_DATES flag is set, the invalid dates (for example, 30th\nFebruary) are allowed. If not, if the NO_ZERO_DATE is set, an error is\nproduced; otherwise, a zero-date is returned.\n\nUnless the NO_ZERO_IN_DATE flag is set, each subpart of a date or time value\n(years, hours...) can be set to 0.\n\nURL: https://mariadb.com/kb/en/date-and-time-literals/','','https://mariadb.com/kb/en/date-and-time-literals/'); @@ -582,12 +579,12 @@ insert into help_topic (help_topic_id,help_category_id,name,description,example, insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (482,29,'Numeric Literals','Numeric literals are written as a sequence of digits from 0 to 9. Initial\nzeros are ignored. A sign can always precede the digits, but it is optional\nfor positive numbers. In decimal numbers, the integer part and the decimal\npart are divided with a dot (.).\n\nIf the integer part is zero, it can be omitted, but the literal must begin\nwith a dot.\n\nThe notation with exponent can be used. The exponent is preceded by an E or e\ncharacter. The exponent can be preceded by a sign and must be an integer. A\nnumber N with an exponent part X, is calculated as N * POW(10, X).\n\nIn some cases, adding zeroes at the end of a decimal number can increment the\nprecision of the expression where the number is used. For example, PI() by\ndefault returns a number with 6 decimal digits. But the PI()+0.0000000000\nexpression (with 10 zeroes) returns a number with 10 decimal digits.\n\nHexadecimal literals are interpreted as numbers when used in numeric contexts.\n\nExamples\n--------\n\n10\n+10\n-10\n\nAll these literals are equivalent:\n\n0.1\n.1\n+0.1\n+.1\n\nWith exponents:\n\n0.2E3 -- 0.2 * POW(10, 3) = 200\n.2e3\n.2e+2\n1.1e-10 -- 0.00000000011\n-1.1e10 -- -11000000000\n\nURL: https://mariadb.com/kb/en/numeric-iterals/','','https://mariadb.com/kb/en/numeric-iterals/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (483,29,'Reserved Words','The following is a list of all reserved words in MariaDB.\n\nReserved words cannot be used as Identifiers, unless they are quoted.\n\nThe definitive list of reserved words for each version can be found by\nexamining the sql/lex.h and sql/sql_yacc.yy files.\n\nReserved Words\n--------------\n\n+--------------------------------------------+--------------------------------+\n| Keyword | Notes |\n+--------------------------------------------+--------------------------------+\n| ACCESSIBLE | |\n+--------------------------------------------+--------------------------------+\n| ADD | |\n+--------------------------------------------+--------------------------------+\n| ALL | |\n+--------------------------------------------+--------------------------------+\n| ALTER | |\n+--------------------------------------------+--------------------------------+\n| ANALYZE | |\n+--------------------------------------------+--------------------------------+\n| AND | |\n+--------------------------------------------+--------------------------------+\n| AS | |\n+--------------------------------------------+--------------------------------+\n| ASC | |\n+--------------------------------------------+--------------------------------+\n| ASENSITIVE | |\n+--------------------------------------------+--------------------------------+\n| BEFORE | |\n+--------------------------------------------+--------------------------------+\n| BETWEEN | |\n+--------------------------------------------+--------------------------------+\n| BIGINT | |\n+--------------------------------------------+--------------------------------+\n| BINARY | |\n+--------------------------------------------+--------------------------------+\n| BLOB | |\n+--------------------------------------------+--------------------------------+\n| BOTH | |\n+--------------------------------------------+--------------------------------+\n| BY | |\n+--------------------------------------------+--------------------------------+\n| CALL | |\n+--------------------------------------------+--------------------------------+\n| CASCADE | |\n+--------------------------------------------+--------------------------------+\n| CASE | |\n+--------------------------------------------+--------------------------------+\n| CHANGE | |\n+--------------------------------------------+--------------------------------+\n| CHAR | |\n+--------------------------------------------+--------------------------------+\n| CHARACTER | |\n+--------------------------------------------+--------------------------------+\n| CHECK | |\n+--------------------------------------------+--------------------------------+\n| COLLATE | |\n+--------------------------------------------+--------------------------------+\n| COLUMN | |\n+--------------------------------------------+--------------------------------+\n| CONDITION | |\n+--------------------------------------------+--------------------------------+\n| CONSTRAINT | |\n+--------------------------------------------+--------------------------------+\n| CONTINUE | |\n+--------------------------------------------+--------------------------------+\n| CONVERT | |\n+--------------------------------------------+--------------------------------+\n| CREATE | |\n+--------------------------------------------+--------------------------------+\n| CROSS | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_DATE | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_ROLE | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_TIME | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_TIMESTAMP | |\n+--------------------------------------------+--------------------------------+\n| CURRENT_USER | |\n+--------------------------------------------+--------------------------------+\n| CURSOR | |\n+--------------------------------------------+--------------------------------+\n| DATABASE | |\n+--------------------------------------------+--------------------------------+\n| DATABASES | |\n+--------------------------------------------+--------------------------------+\n| DAY_HOUR | |\n+--------------------------------------------+--------------------------------+\n| DAY_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| DAY_MINUTE | |\n+--------------------------------------------+--------------------------------+\n| DAY_SECOND | |\n+--------------------------------------------+--------------------------------+\n| DEC | |\n+--------------------------------------------+--------------------------------+\n| DECIMAL | |\n+--------------------------------------------+--------------------------------+\n| DECLARE | |\n+--------------------------------------------+--------------------------------+\n| DEFAULT | |\n+--------------------------------------------+--------------------------------+\n| DELAYED | |\n+--------------------------------------------+--------------------------------+\n| DELETE | |\n+--------------------------------------------+--------------------------------+\n| DELETE_DOMAIN_ID | |\n+--------------------------------------------+--------------------------------+\n| DESC | |\n+--------------------------------------------+--------------------------------+\n| DESCRIBE | |\n+--------------------------------------------+--------------------------------+\n| DETERMINISTIC | |\n+--------------------------------------------+--------------------------------+\n| DISTINCT | |\n+--------------------------------------------+--------------------------------+\n| DISTINCTROW | |\n+--------------------------------------------+--------------------------------+\n| DIV | |\n+--------------------------------------------+--------------------------------+\n| DO_DOMAIN_IDS | |\n+--------------------------------------------+--------------------------------+\n| DOUBLE | |\n+--------------------------------------------+--------------------------------+\n| DROP | |\n+--------------------------------------------+--------------------------------+\n| DUAL | |\n+--------------------------------------------+--------------------------------+\n| EACH | |\n+--------------------------------------------+--------------------------------+\n| ELSE | |\n+--------------------------------------------+--------------------------------+\n| ELSEIF | |\n+--------------------------------------------+--------------------------------+\n| ENCLOSED | |\n+--------------------------------------------+--------------------------------+\n| ESCAPED | |\n+--------------------------------------------+--------------------------------+\n| EXCEPT | Added in MariaDB 10.3.0 |\n+--------------------------------------------+--------------------------------+\n| EXISTS | |\n+--------------------------------------------+--------------------------------+\n| EXIT | |\n+--------------------------------------------+--------------------------------+\n| EXPLAIN | |\n+--------------------------------------------+--------------------------------+\n| FALSE | |\n+--------------------------------------------+--------------------------------+\n| FETCH | |\n+--------------------------------------------+--------------------------------+\n| FLOAT | |\n+--------------------------------------------+--------------------------------+\n| FLOAT4 | |\n+--------------------------------------------+--------------------------------+\n| FLOAT8 | |\n+--------------------------------------------+--------------------------------+\n| FOR | |\n+--------------------------------------------+--------------------------------+\n| FORCE | |\n+--------------------------------------------+--------------------------------+\n| FOREIGN | |\n+--------------------------------------------+--------------------------------+\n| FROM | |\n+--------------------------------------------+--------------------------------+\n| FULLTEXT | |\n+--------------------------------------------+--------------------------------+\n| GENERAL | |\n+--------------------------------------------+--------------------------------+\n| GRANT | |\n+--------------------------------------------+--------------------------------+\n| GROUP | |\n+--------------------------------------------+--------------------------------+\n| HAVING | |\n+--------------------------------------------+--------------------------------+\n| HIGH_PRIORITY | |\n+--------------------------------------------+--------------------------------+\n| HOUR_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| HOUR_MINUTE | |\n+--------------------------------------------+--------------------------------+\n| HOUR_SECOND | |','','https://mariadb.com/kb/en/reserved-words/'); update help_topic set description = CONCAT(description, '\n+--------------------------------------------+--------------------------------+\n| IF | |\n+--------------------------------------------+--------------------------------+\n| IGNORE | |\n+--------------------------------------------+--------------------------------+\n| IGNORE_DOMAIN_IDS | |\n+--------------------------------------------+--------------------------------+\n| IGNORE_SERVER_IDS | |\n+--------------------------------------------+--------------------------------+\n| IN | |\n+--------------------------------------------+--------------------------------+\n| INDEX | |\n+--------------------------------------------+--------------------------------+\n| INFILE | |\n+--------------------------------------------+--------------------------------+\n| INNER | |\n+--------------------------------------------+--------------------------------+\n| INOUT | |\n+--------------------------------------------+--------------------------------+\n| INSENSITIVE | |\n+--------------------------------------------+--------------------------------+\n| INSERT | |\n+--------------------------------------------+--------------------------------+\n| INT | |\n+--------------------------------------------+--------------------------------+\n| INT1 | |\n+--------------------------------------------+--------------------------------+\n| INT2 | |\n+--------------------------------------------+--------------------------------+\n| INT3 | |\n+--------------------------------------------+--------------------------------+\n| INT4 | |\n+--------------------------------------------+--------------------------------+\n| INT8 | |\n+--------------------------------------------+--------------------------------+\n| INTEGER | |\n+--------------------------------------------+--------------------------------+\n| INTERSECT | Added in MariaDB 10.3.0 |\n+--------------------------------------------+--------------------------------+\n| INTERVAL | |\n+--------------------------------------------+--------------------------------+\n| INTO | |\n+--------------------------------------------+--------------------------------+\n| IS | |\n+--------------------------------------------+--------------------------------+\n| ITERATE | |\n+--------------------------------------------+--------------------------------+\n| JOIN | |\n+--------------------------------------------+--------------------------------+\n| KEY | |\n+--------------------------------------------+--------------------------------+\n| KEYS | |\n+--------------------------------------------+--------------------------------+\n| KILL | |\n+--------------------------------------------+--------------------------------+\n| LEADING | |\n+--------------------------------------------+--------------------------------+\n| LEAVE | |\n+--------------------------------------------+--------------------------------+\n| LEFT | |\n+--------------------------------------------+--------------------------------+\n| LIKE | |\n+--------------------------------------------+--------------------------------+\n| LIMIT | |\n+--------------------------------------------+--------------------------------+\n| LINEAR | |\n+--------------------------------------------+--------------------------------+\n| LINES | |\n+--------------------------------------------+--------------------------------+\n| LOAD | |\n+--------------------------------------------+--------------------------------+\n| LOCALTIME | |\n+--------------------------------------------+--------------------------------+\n| LOCALTIMESTAMP | |\n+--------------------------------------------+--------------------------------+\n| LOCK | |\n+--------------------------------------------+--------------------------------+\n| LONG | |\n+--------------------------------------------+--------------------------------+\n| LONGBLOB | |\n+--------------------------------------------+--------------------------------+\n| LONGTEXT | |\n+--------------------------------------------+--------------------------------+\n| LOOP | |\n+--------------------------------------------+--------------------------------+\n| LOW_PRIORITY | |\n+--------------------------------------------+--------------------------------+\n| MASTER_HEARTBEAT_PERIOD | |\n+--------------------------------------------+--------------------------------+\n| MASTER_SSL_VERIFY_SERVER_CERT | |\n+--------------------------------------------+--------------------------------+\n| MATCH | |\n+--------------------------------------------+--------------------------------+\n| MAXVALUE | |\n+--------------------------------------------+--------------------------------+\n| MEDIUMBLOB | |\n+--------------------------------------------+--------------------------------+\n| MEDIUMINT | |\n+--------------------------------------------+--------------------------------+\n| MEDIUMTEXT | |\n+--------------------------------------------+--------------------------------+\n| MIDDLEINT | |\n+--------------------------------------------+--------------------------------+\n| MINUTE_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| MINUTE_SECOND | |\n+--------------------------------------------+--------------------------------+\n| MOD | |\n+--------------------------------------------+--------------------------------+\n| MODIFIES | |\n+--------------------------------------------+--------------------------------+\n| NATURAL | |\n+--------------------------------------------+--------------------------------+\n| NOT | |\n+--------------------------------------------+--------------------------------+\n| NO_WRITE_TO_BINLOG | |\n+--------------------------------------------+--------------------------------+\n| NULL | |\n+--------------------------------------------+--------------------------------+\n| NUMERIC | |\n+--------------------------------------------+--------------------------------+\n| OFFSET | Added in MariaDB 10.6.0 |\n+--------------------------------------------+--------------------------------+\n| ON | |\n+--------------------------------------------+--------------------------------+\n| OPTIMIZE | |\n+--------------------------------------------+--------------------------------+\n| OPTION | |\n+--------------------------------------------+--------------------------------+\n| OPTIONALLY | |\n+--------------------------------------------+--------------------------------+\n| OR | |\n+--------------------------------------------+--------------------------------+\n| ORDER | |\n+--------------------------------------------+--------------------------------+\n| OUT | |\n+--------------------------------------------+--------------------------------+\n| OUTER | |\n+--------------------------------------------+--------------------------------+\n| OUTFILE | |\n+--------------------------------------------+--------------------------------+\n| OVER | |\n+--------------------------------------------+--------------------------------+\n| PAGE_CHECKSUM | |\n+--------------------------------------------+--------------------------------+\n| PARSE_VCOL_EXPR | |\n+--------------------------------------------+--------------------------------+\n| PARTITION | |\n+--------------------------------------------+--------------------------------+\n| POSITION | |\n+--------------------------------------------+--------------------------------+\n| PRECISION | |\n+--------------------------------------------+--------------------------------+\n| PRIMARY | |\n+--------------------------------------------+--------------------------------+\n| PROCEDURE | |\n+--------------------------------------------+--------------------------------+\n| PURGE | |\n+--------------------------------------------+--------------------------------+\n| RANGE | |\n+--------------------------------------------+--------------------------------+\n| READ | |\n+--------------------------------------------+--------------------------------+\n| READS | |\n+--------------------------------------------+--------------------------------+\n| READ_WRITE | |\n+--------------------------------------------+--------------------------------+\n| REAL | |\n+--------------------------------------------+--------------------------------+\n| RECURSIVE | |\n+--------------------------------------------+--------------------------------+\n| REF_SYSTEM_ID | |\n+--------------------------------------------+--------------------------------+\n| REFERENCES | |\n+--------------------------------------------+--------------------------------+\n| REGEXP | |\n+--------------------------------------------+--------------------------------+\n| RELEASE | |\n+--------------------------------------------+--------------------------------+\n| RENAME | |') WHERE help_topic_id = 483; -update help_topic set description = CONCAT(description, '\n+--------------------------------------------+--------------------------------+\n| REPEAT | |\n+--------------------------------------------+--------------------------------+\n| REPLACE | |\n+--------------------------------------------+--------------------------------+\n| REQUIRE | |\n+--------------------------------------------+--------------------------------+\n| RESIGNAL | |\n+--------------------------------------------+--------------------------------+\n| RESTRICT | |\n+--------------------------------------------+--------------------------------+\n| RETURN | |\n+--------------------------------------------+--------------------------------+\n| RETURNING | |\n+--------------------------------------------+--------------------------------+\n| REVOKE | |\n+--------------------------------------------+--------------------------------+\n| RIGHT | |\n+--------------------------------------------+--------------------------------+\n| RLIKE | |\n+--------------------------------------------+--------------------------------+\n| ROWS | |\n+--------------------------------------------+--------------------------------+\n| SCHEMA | |\n+--------------------------------------------+--------------------------------+\n| SCHEMAS | |\n+--------------------------------------------+--------------------------------+\n| SECOND_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| SELECT | |\n+--------------------------------------------+--------------------------------+\n| SENSITIVE | |\n+--------------------------------------------+--------------------------------+\n| SEPARATOR | |\n+--------------------------------------------+--------------------------------+\n| SET | |\n+--------------------------------------------+--------------------------------+\n| SHOW | |\n+--------------------------------------------+--------------------------------+\n| SIGNAL | |\n+--------------------------------------------+--------------------------------+\n| SLOW | |\n+--------------------------------------------+--------------------------------+\n| SMALLINT | |\n+--------------------------------------------+--------------------------------+\n| SPATIAL | |\n+--------------------------------------------+--------------------------------+\n| SPECIFIC | |\n+--------------------------------------------+--------------------------------+\n| SQL | |\n+--------------------------------------------+--------------------------------+\n| SQLEXCEPTION | |\n+--------------------------------------------+--------------------------------+\n| SQLSTATE | |\n+--------------------------------------------+--------------------------------+\n| SQLWARNING | |\n+--------------------------------------------+--------------------------------+\n| SQL_BIG_RESULT | |\n+--------------------------------------------+--------------------------------+\n| SQL_CALC_FOUND_ROWS | |\n+--------------------------------------------+--------------------------------+\n| SQL_SMALL_RESULT | |\n+--------------------------------------------+--------------------------------+\n| SSL | |\n+--------------------------------------------+--------------------------------+\n| STARTING | |\n+--------------------------------------------+--------------------------------+\n| STATS_AUTO_RECALC | |\n+--------------------------------------------+--------------------------------+\n| STATS_PERSISTENT | |\n+--------------------------------------------+--------------------------------+\n| STATS_SAMPLE_PAGES | |\n+--------------------------------------------+--------------------------------+\n| STRAIGHT_JOIN | |\n+--------------------------------------------+--------------------------------+\n| TABLE | |\n+--------------------------------------------+--------------------------------+\n| TERMINATED | |\n+--------------------------------------------+--------------------------------+\n| THEN | |\n+--------------------------------------------+--------------------------------+\n| TINYBLOB | |\n+--------------------------------------------+--------------------------------+\n| TINYINT | |\n+--------------------------------------------+--------------------------------+\n| TINYTEXT | |\n+--------------------------------------------+--------------------------------+\n| TO | |\n+--------------------------------------------+--------------------------------+\n| TRAILING | |\n+--------------------------------------------+--------------------------------+\n| TRIGGER | |\n+--------------------------------------------+--------------------------------+\n| TRUE | |\n+--------------------------------------------+--------------------------------+\n| UNDO | |\n+--------------------------------------------+--------------------------------+\n| UNION | |\n+--------------------------------------------+--------------------------------+\n| UNIQUE | |\n+--------------------------------------------+--------------------------------+\n| UNLOCK | |\n+--------------------------------------------+--------------------------------+\n| UNSIGNED | |\n+--------------------------------------------+--------------------------------+\n| UPDATE | |\n+--------------------------------------------+--------------------------------+\n| USAGE | |\n+--------------------------------------------+--------------------------------+\n| USE | |\n+--------------------------------------------+--------------------------------+\n| USING | |\n+--------------------------------------------+--------------------------------+\n| UTC_DATE | |\n+--------------------------------------------+--------------------------------+\n| UTC_TIME | |\n+--------------------------------------------+--------------------------------+\n| UTC_TIMESTAMP | |\n+--------------------------------------------+--------------------------------+\n| VALUES | |\n+--------------------------------------------+--------------------------------+\n| VARBINARY | |\n+--------------------------------------------+--------------------------------+\n| VARCHAR | |\n+--------------------------------------------+--------------------------------+\n| VARCHARACTER | |\n+--------------------------------------------+--------------------------------+\n| VARYING | |\n+--------------------------------------------+--------------------------------+\n| WHEN | |\n+--------------------------------------------+--------------------------------+\n| WHERE | |\n+--------------------------------------------+--------------------------------+\n| WHILE | |\n+--------------------------------------------+--------------------------------+\n| WINDOW | Only disallowed for table |\n| | aliases. |\n+--------------------------------------------+--------------------------------+\n| WITH | |\n+--------------------------------------------+--------------------------------+\n| WRITE | |\n+--------------------------------------------+--------------------------------+\n| XOR | |\n+--------------------------------------------+--------------------------------+\n| YEAR_MONTH | |\n+--------------------------------------------+--------------------------------+\n| ZEROFILL | |\n+--------------------------------------------+--------------------------------+\n\nExceptions\n----------\n\nSome keywords are exceptions for historical reasons, and are permitted as\nunquoted identifiers. These include:\n\n+-----------------------------------------------------------------------------+\n| Keyword |\n+-----------------------------------------------------------------------------+\n| ACTION |\n+-----------------------------------------------------------------------------+\n| BIT |\n+-----------------------------------------------------------------------------+\n| DATE |\n+-----------------------------------------------------------------------------+\n| ENUM |\n+-----------------------------------------------------------------------------+\n| NO |\n+-----------------------------------------------------------------------------+\n| TEXT |\n+-----------------------------------------------------------------------------+\n| TIME |\n+-----------------------------------------------------------------------------+\n| TIMESTAMP |\n+-----------------------------------------------------------------------------+\n\nOracle Mode\n-----------\n\nIn Oracle mode, from MariaDB 10.3, there are a number of extra reserved words:\n\n+--------------------------------------------+--------------------------------+\n| Keyword | Notes |\n+--------------------------------------------+--------------------------------+\n| BODY | |\n+--------------------------------------------+--------------------------------+\n| ELSIF | |\n+--------------------------------------------+--------------------------------+\n| GOTO | |\n+--------------------------------------------+--------------------------------+\n| HISTORY | <= MariaDB 10.3.6 only |') WHERE help_topic_id = 483; -update help_topic set description = CONCAT(description, '\n+--------------------------------------------+--------------------------------+\n| MINUS | From MariaDB 10.6.1 |\n+--------------------------------------------+--------------------------------+\n| OTHERS | |\n+--------------------------------------------+--------------------------------+\n| PACKAGE | |\n+--------------------------------------------+--------------------------------+\n| PERIOD | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| RAISE | |\n+--------------------------------------------+--------------------------------+\n| ROWNUM | From MariaDB 10.6.1 |\n+--------------------------------------------+--------------------------------+\n| ROWTYPE | |\n+--------------------------------------------+--------------------------------+\n| SYSDATE | From MariaDB 10.6.1 |\n+--------------------------------------------+--------------------------------+\n| SYSTEM | <= MariaDB 10.3.6 only. Note |\n| | however that SYSTEM sometimes |\n| | needs to be quoted to avoid |\n| | confusion with |\n| | System-versioned tables. |\n+--------------------------------------------+--------------------------------+\n| SYSTEM_TIME | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| VERSIONING | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| WITHOUT | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n\nFunction Names\n--------------\n\nIf the IGNORE_SPACE SQL_MODE flag is set, function names become reserved words.\n\nURL: https://mariadb.com/kb/en/reserved-words/') WHERE help_topic_id = 483; +update help_topic set description = CONCAT(description, '\n+--------------------------------------------+--------------------------------+\n| REPEAT | |\n+--------------------------------------------+--------------------------------+\n| REPLACE | |\n+--------------------------------------------+--------------------------------+\n| REQUIRE | |\n+--------------------------------------------+--------------------------------+\n| RESIGNAL | |\n+--------------------------------------------+--------------------------------+\n| RESTRICT | |\n+--------------------------------------------+--------------------------------+\n| RETURN | |\n+--------------------------------------------+--------------------------------+\n| RETURNING | |\n+--------------------------------------------+--------------------------------+\n| REVOKE | |\n+--------------------------------------------+--------------------------------+\n| RIGHT | |\n+--------------------------------------------+--------------------------------+\n| RLIKE | |\n+--------------------------------------------+--------------------------------+\n| ROW_NUMBER | From MariaDB 10.7 |\n+--------------------------------------------+--------------------------------+\n| ROWS | |\n+--------------------------------------------+--------------------------------+\n| SCHEMA | |\n+--------------------------------------------+--------------------------------+\n| SCHEMAS | |\n+--------------------------------------------+--------------------------------+\n| SECOND_MICROSECOND | |\n+--------------------------------------------+--------------------------------+\n| SELECT | |\n+--------------------------------------------+--------------------------------+\n| SENSITIVE | |\n+--------------------------------------------+--------------------------------+\n| SEPARATOR | |\n+--------------------------------------------+--------------------------------+\n| SET | |\n+--------------------------------------------+--------------------------------+\n| SHOW | |\n+--------------------------------------------+--------------------------------+\n| SIGNAL | |\n+--------------------------------------------+--------------------------------+\n| SLOW | |\n+--------------------------------------------+--------------------------------+\n| SMALLINT | |\n+--------------------------------------------+--------------------------------+\n| SPATIAL | |\n+--------------------------------------------+--------------------------------+\n| SPECIFIC | |\n+--------------------------------------------+--------------------------------+\n| SQL | |\n+--------------------------------------------+--------------------------------+\n| SQLEXCEPTION | |\n+--------------------------------------------+--------------------------------+\n| SQLSTATE | |\n+--------------------------------------------+--------------------------------+\n| SQLWARNING | |\n+--------------------------------------------+--------------------------------+\n| SQL_BIG_RESULT | |\n+--------------------------------------------+--------------------------------+\n| SQL_CALC_FOUND_ROWS | |\n+--------------------------------------------+--------------------------------+\n| SQL_SMALL_RESULT | |\n+--------------------------------------------+--------------------------------+\n| SSL | |\n+--------------------------------------------+--------------------------------+\n| STARTING | |\n+--------------------------------------------+--------------------------------+\n| STATS_AUTO_RECALC | |\n+--------------------------------------------+--------------------------------+\n| STATS_PERSISTENT | |\n+--------------------------------------------+--------------------------------+\n| STATS_SAMPLE_PAGES | |\n+--------------------------------------------+--------------------------------+\n| STRAIGHT_JOIN | |\n+--------------------------------------------+--------------------------------+\n| TABLE | |\n+--------------------------------------------+--------------------------------+\n| TERMINATED | |\n+--------------------------------------------+--------------------------------+\n| THEN | |\n+--------------------------------------------+--------------------------------+\n| TINYBLOB | |\n+--------------------------------------------+--------------------------------+\n| TINYINT | |\n+--------------------------------------------+--------------------------------+\n| TINYTEXT | |\n+--------------------------------------------+--------------------------------+\n| TO | |\n+--------------------------------------------+--------------------------------+\n| TRAILING | |\n+--------------------------------------------+--------------------------------+\n| TRIGGER | |\n+--------------------------------------------+--------------------------------+\n| TRUE | |\n+--------------------------------------------+--------------------------------+\n| UNDO | |\n+--------------------------------------------+--------------------------------+\n| UNION | |\n+--------------------------------------------+--------------------------------+\n| UNIQUE | |\n+--------------------------------------------+--------------------------------+\n| UNLOCK | |\n+--------------------------------------------+--------------------------------+\n| UNSIGNED | |\n+--------------------------------------------+--------------------------------+\n| UPDATE | |\n+--------------------------------------------+--------------------------------+\n| USAGE | |\n+--------------------------------------------+--------------------------------+\n| USE | |\n+--------------------------------------------+--------------------------------+\n| USING | |\n+--------------------------------------------+--------------------------------+\n| UTC_DATE | |\n+--------------------------------------------+--------------------------------+\n| UTC_TIME | |\n+--------------------------------------------+--------------------------------+\n| UTC_TIMESTAMP | |\n+--------------------------------------------+--------------------------------+\n| VALUES | |\n+--------------------------------------------+--------------------------------+\n| VARBINARY | |\n+--------------------------------------------+--------------------------------+\n| VARCHAR | |\n+--------------------------------------------+--------------------------------+\n| VARCHARACTER | |\n+--------------------------------------------+--------------------------------+\n| VARYING | |\n+--------------------------------------------+--------------------------------+\n| WHEN | |\n+--------------------------------------------+--------------------------------+\n| WHERE | |\n+--------------------------------------------+--------------------------------+\n| WHILE | |\n+--------------------------------------------+--------------------------------+\n| WINDOW | Only disallowed for table |\n| | aliases. |\n+--------------------------------------------+--------------------------------+\n| WITH | |\n+--------------------------------------------+--------------------------------+\n| WRITE | |\n+--------------------------------------------+--------------------------------+\n| XOR | |\n+--------------------------------------------+--------------------------------+\n| YEAR_MONTH | |\n+--------------------------------------------+--------------------------------+\n| ZEROFILL | |\n+--------------------------------------------+--------------------------------+\n\nExceptions\n----------\n\nSome keywords are exceptions for historical reasons, and are permitted as\nunquoted identifiers. These include:\n\n+-----------------------------------------------------------------------------+\n| Keyword |\n+-----------------------------------------------------------------------------+\n| ACTION |\n+-----------------------------------------------------------------------------+\n| BIT |\n+-----------------------------------------------------------------------------+\n| DATE |\n+-----------------------------------------------------------------------------+\n| ENUM |\n+-----------------------------------------------------------------------------+\n| NO |\n+-----------------------------------------------------------------------------+\n| TEXT |\n+-----------------------------------------------------------------------------+\n| TIME |\n+-----------------------------------------------------------------------------+\n| TIMESTAMP |\n+-----------------------------------------------------------------------------+\n\nOracle Mode\n-----------\n\nIn Oracle mode, from MariaDB 10.3, there are a number of extra reserved words:\n\n+--------------------------------------------+--------------------------------+\n| Keyword | Notes |\n+--------------------------------------------+--------------------------------+\n| BODY | |\n+--------------------------------------------+--------------------------------+\n| ELSIF | |\n+--------------------------------------------+--------------------------------+\n| GOTO | |') WHERE help_topic_id = 483; +update help_topic set description = CONCAT(description, '\n+--------------------------------------------+--------------------------------+\n| HISTORY | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| MINUS | From MariaDB 10.6.1 |\n+--------------------------------------------+--------------------------------+\n| OTHERS | |\n+--------------------------------------------+--------------------------------+\n| PACKAGE | |\n+--------------------------------------------+--------------------------------+\n| PERIOD | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| RAISE | |\n+--------------------------------------------+--------------------------------+\n| ROWNUM | From MariaDB 10.6.1 |\n+--------------------------------------------+--------------------------------+\n| ROWTYPE | |\n+--------------------------------------------+--------------------------------+\n| SYSDATE | From MariaDB 10.6.1 |\n+--------------------------------------------+--------------------------------+\n| SYSTEM | <= MariaDB 10.3.6 only. Note |\n| | however that SYSTEM sometimes |\n| | needs to be quoted to avoid |\n| | confusion with |\n| | System-versioned tables. |\n+--------------------------------------------+--------------------------------+\n| SYSTEM_TIME | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| VERSIONING | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n| WITHOUT | <= MariaDB 10.3.6 only |\n+--------------------------------------------+--------------------------------+\n\nFunction Names\n--------------\n\nIf the IGNORE_SPACE SQL_MODE flag is set, function names become reserved words.\n\nURL: https://mariadb.com/kb/en/reserved-words/') WHERE help_topic_id = 483; insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (484,29,'String Literals','Strings are sequences of characters and are enclosed with quotes.\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 quotes (the same\ncharacter must be used to both open and close the string).\n\nThe ANSI SQL-standard does not permit double quotes for enclosing strings, and\nalthough MariaDB does by default, if the MariaDB server has enabled the\nANSI_QUOTES_SQL SQL_MODE, double quotes will be treated as being used for\nidentifiers instead of strings.\n\nStrings that are next to each other are automatically concatenated. For\nexample:\n\n\'The \' \'MariaDB \' \'Foundation\'\n\nand\n\n\'The MariaDB Foundation\'\n\nare equivalent.\n\nThe \\ (backslash character) is used to escape characters (unless the SQL_MODE\nhasn\'t been set to NO_BACKSLASH_ESCAPES). For example:\n\n\'MariaDB\'s new features\'\n\nis not a valid string because of the single quote in the middle of the string,\nwhich is treated as if it closes the string, but is actually meant as part of\nthe string, an apostrophe. 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 the 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 twice:\n\nSELECT \'I\'\'m here\', \"\"\"Double\"\"\";\n+----------+----------+\n| I\'m here | \"Double\" |\n+----------+----------+\n| I\'m here | \"Double\" |\n+----------+----------+\n\nEscape Sequences\n----------------\n\nThere are other escape sequences also. Here is a full list:\n\n+-----------------------------------------------+-----------------------------+\n| Escape 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 |\n| | note following the table. |\n+-----------------------------------------------+-----------------------------+\n| \\\\ | Backslash (\"\\\"). |\n+-----------------------------------------------+-----------------------------+\n| \\% | \"%\" character. See note |\n| | following the table. |\n+-----------------------------------------------+-----------------------------+\n| \\_ | A \"_\" character. See note |\n| | following the table. |\n+-----------------------------------------------+-----------------------------+\n\nEscaping the % and _ characters can be necessary when using the LIKE operator,\nwhich treats them as special characters.\n\nThe ASCII 26 character (\\Z) needs to be escaped when included in a batch file\nwhich needs to be executed in Windows. The reason is that ASCII 26, in\nWindows, is the end of file (EOF).\n\nBackslash (\\), if not used as an escape character, must always be escaped.\nWhen followed by a character that is not in the above table, backslashes will\nsimply be ignored.\n\nURL: https://mariadb.com/kb/en/string-literals/','','https://mariadb.com/kb/en/string-literals/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (485,29,'Table Value Constructors','MariaDB starting with 10.3.3\n----------------------------\nTable Value Constructors were introduced in MariaDB 10.3.3\n\nSyntax\n------\n\nVALUES ( row_value[, row_value...]), (...)...\n\nDescription\n-----------\n\nIn Unions, Views, and sub-queries, a Table Value Constructor (TVC) allows you\nto inject arbitrary values into the result-set. The given values must have the\nsame number of columns as the result-set, otherwise it returns Error 1222.\n\nExamples\n--------\n\nUsing TVC\'s with UNION operations:\n\nCREATE TABLE test.t1 (val1 INT, val2 INT);\nINSERT INTO test.t1 VALUES(5, 8), (3, 4), (1, 2);\n\nSELECT * FROM test.t1\nUNION\nVALUES (70, 90), (100, 110);\n\n+------+------+\n| val1 | val2 |\n+------+------+\n| 5 | 8 | \n| 3 | 4 |\n| 1 | 2 |\n| 70 | 90 |\n| 100 | 110 |\n+------+------+\n\nUsing TVC\'s with a CREATE VIEW statement:\n\nCREATE VIEW v1 AS VALUES (7, 9), (9, 10);\n\nSELECT * FROM v1;\n+---+----+\n| 7 | 9 |\n+---+----+\n| 7 | 9 |\n| 9 | 10 |\n+---+----+\n\nUsing TVC with an ORDER BY clause:\n\nSELECT * FROM test.t1\nUNION\nVALUES (10, 20), (30, 40), (50, 60), (70, 80)\nORDER BY val1 DESC;\n\nUsing TVC with LIMIT clause:\n\nSELECT * FROM test.t1\nUNION\nVALUES (10, 20), (30, 40), (50, 60), (70, 80)\nLIMIT 2 OFFSET 4;\n\n+------+------+\n| val1 | val2 |\n+------+------+\n| 30 | 40 | \n| 50 | 60 |\n+------+------+\n\nURL: https://mariadb.com/kb/en/table-value-constructors/','','https://mariadb.com/kb/en/table-value-constructors/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (486,29,'User-Defined Variables','User-defined variables are variables which can be created by the user and\nexist in the session. This means that no one can access user-defined variables\nthat have been set by another user, and when the session is closed these\nvariables expire. However, these variables can be shared between several\nqueries and stored programs.\n\nUser-defined variables names must be preceded by a single at character (@).\nWhile it is safe to use a reserved word as a user-variable name, the only\nallowed characters are ASCII letters, digits, dollar sign ($), underscore (_)\nand dot (.). If other characters are used, the name can be quoted in one of\nthe following ways:\n\n* @`var_name`\n* @\'var_name\'\n* @\"var_name\"\n\nThese characters can be escaped as usual.\n\nUser-variables names are case insensitive, though they were case sensitive in\nMySQL 4.1 and older versions.\n\nUser-defined variables cannot be declared. They can be read even if no value\nhas been set yet; in that case, they are NULL. To set a value for a\nuser-defined variable you can use:\n\n* SET statement;\n* := operator within a SQL statement;\n* SELECT ... INTO.\n\nSince user-defined variables type cannot be declared, the only way to force\ntheir type is using CAST() or CONVERT():\n\nSET @str = CAST(123 AS CHAR(5));\n\nIf a variable has not been used yet, its value is NULL:\n\nSELECT @x IS NULL;\n+------------+\n| @x IS NULL |\n+------------+\n| 1 |\n+------------+\n\nIt is unsafe to read a user-defined variable and set its value in the same\nstatement (unless the command is SET), because the order of these actions is\nundefined.\n\nUser-defined variables can be used in most MariaDB\'s statements and clauses\nwhich accept an SQL expression. However there are some exceptions, like the\nLIMIT clause.\n\nThey must be used to PREPARE a prepared statement:\n\n@sql = \'DELETE FROM my_table WHERE c>1;\';\nPREPARE stmt FROM @sql;\nEXECUTE stmt;\nDEALLOCATE PREPARE stmt;\n\nAnother common use is to include a counter in a query:\n\nSET @var = 0;\nSELECT a, b, c, (@var:=@var+1) AS counter FROM my_table;\n\nInformation Schema\n------------------\n\nUser-defined variables can be viewed in the Information Schema USER_VARIABLES\nTable (as part of the User Variables plugin) from MariaDB 10.2.\n\nFlushing User-Defined Variables\n-------------------------------\n\nUser-defined variables are reset and the Information Schema table emptied with\nthe FLUSH USER_VARIABLES statement.\n\nSET @str = CAST(123 AS CHAR(5));\n\nSELECT * FROM information_schema.USER_VARIABLES ORDER BY VARIABLE_NAME;\n+---------------+----------------+---------------+--------------------+\n| VARIABLE_NAME | VARIABLE_VALUE | VARIABLE_TYPE | CHARACTER_SET_NAME |\n+---------------+----------------+---------------+--------------------+\n| str | 123 | VARCHAR | utf8mb3 |\n+---------------+----------------+---------------+--------------------+\n\nFLUSH USER_VARIABLES;\n\nSELECT * FROM information_schema.USER_VARIABLES ORDER BY VARIABLE_NAME;\nEmpty set (0.000 sec)\n\nURL: https://mariadb.com/kb/en/user-defined-variables/','','https://mariadb.com/kb/en/user-defined-variables/'); -insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (487,29,'Delimiters','The default delimiter in the mysql client (from MariaDB 10.4.6, also called\nmariadb) is the semicolon.\n\nWhen creating stored programs from the command-line, it is likely you will\nneed to differentiate between the regular delimiter and a delimiter inside a\nBEGIN END block. To understand better, consider the following example:\n\nCREATE FUNCTION FortyTwo() RETURNS TINYINT DETERMINISTIC\nBEGIN\n DECLARE x TINYINT;\n SET x = 42;\n RETURN x;\nEND;\n\nIf you enter the above line by line, the mysql client will treat the first\nsemicolon, at the end of the DECLARE x TINYINT line, as the end of the\nstatement. Since that\'s only a partial definition, it will throw a syntax\nerror, as follows:\n\nCREATE FUNCTION FortyTwo() RETURNS TINYINT DETERMINISTIC\nBEGIN\nDECLARE x TINYINT;\nERROR 1064 (42000): You have an error in your SQL syntax; \ncheck the manual that corresponds to your MariaDB server version\n for the right syntax to use near \'\' at line 3\n\nThe solution is to specify a distinct delimiter for the duration of the\nprocess, using the DELIMITER command. The delimiter can be any set of\ncharacters you choose, but it needs to be a distinctive set of characters that\nwon\'t cause further confusion. // is a common choice, and used throughout the\nknowledgebase.\n\nHere\'s how the function could be successfully entered from the mysql client\nwith the new delimiter.\n\nDELIMITER //\n\nCREATE FUNCTION FortyTwo() RETURNS TINYINT DETERMINISTIC\nBEGIN\n DECLARE x TINYINT;\n SET x = 42;\n RETURN x;\nEND\n\n//\n\nDELIMITER ;\n\nAt the end, the delimiter is restored to the default semicolon. The \\g and \\G\ndelimiters can always be used, even when a custom delimiter is specified.\n\nURL: https://mariadb.com/kb/en/delimiters/','','https://mariadb.com/kb/en/delimiters/'); +insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (487,29,'Delimiters','The default delimiter in the mariadb client is the semicolon.\n\nWhen creating stored programs from the command-line, it is likely you will\nneed to differentiate between the regular delimiter and a delimiter inside a\nBEGIN END block. To understand better, consider the following example:\n\nCREATE FUNCTION FortyTwo() RETURNS TINYINT DETERMINISTIC\nBEGIN\n DECLARE x TINYINT;\n SET x = 42;\n RETURN x;\nEND;\n\nIf you enter the above line by line, the mariadb client will treat the first\nsemicolon, at the end of the DECLARE x TINYINT line, as the end of the\nstatement. Since that\'s only a partial definition, it will throw a syntax\nerror, as follows:\n\nCREATE FUNCTION FortyTwo() RETURNS TINYINT DETERMINISTIC\nBEGIN\nDECLARE x TINYINT;\nERROR 1064 (42000): You have an error in your SQL syntax; \ncheck the manual that corresponds to your MariaDB server version\n for the right syntax to use near \'\' at line 3\n\nThe solution is to specify a distinct delimiter for the duration of the\nprocess, using the DELIMITER command. The delimiter can be any set of\ncharacters you choose, but it needs to be a distinctive set of characters that\nwon\'t cause further confusion. // is a common choice, and used throughout the\nKnowledge Base.\n\nHere\'s how the function could be successfully entered from the mariadb client\nwith the new delimiter.\n\nDELIMITER //\n\nCREATE FUNCTION FortyTwo() RETURNS TINYINT DETERMINISTIC\nBEGIN\n DECLARE x TINYINT;\n SET x = 42;\n RETURN x;\nEND\n\n//\n\nDELIMITER ;\n\nAt the end, the delimiter is restored to the default semicolon. The \\g and \\G\ndelimiters can always be used, even when a custom delimiter is specified.\n\nURL: https://mariadb.com/kb/en/delimiters/','','https://mariadb.com/kb/en/delimiters/'); insert into help_topic (help_topic_id,help_category_id,name,description,example,url) values (488,29,'SQL_MODE=ORACLE','From MariaDB 10.3, setting the sql_mode system variable to Oracle allows the\nserver to understand a subset of Oracle\'s PL/SQL language. For example:\n\nSET SQL_MODE=\'ORACLE\';\n\nAll traditional MariaDB SQL/PSM syntax should work as before, as long as it\ndoes not conflict with Oracle\'s PL/SQL syntax. All MariaDB functions should be\nsupported in both normal and Oracle modes.\n\nPrior to MariaDB 10.3, MariaDB does not support Oracle\'s PL/SQL language, and\nSET SQL_MODE=ORACLE is only an alias for the following sql_mode in those\nversions:\n\nSET SQL_MODE=\'PIPES_AS_CONCAT, ANSI_QUOTES, IGNORE_SPACE, NO_KEY_OPTIONS,\nNO_TABLE_OPTIONS, NO_FIELD_OPTIONS, NO_AUTO_CREATE_USER\';\n\nFrom MariaDB 10.3, SET SQL_MODE=ORACLE is same as:\n\nSET SQL_MODE=\'PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,\nNO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT\';\n\nSupported Syntax in Oracle Mode\n-------------------------------\n\nStored Procedures and Stored Functions\n--------------------------------------\n\nOracle mode makes the following changes to Stored Procedures and Stored\nFunctions:\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 (param OUT INT) | ANSI uses (OUT param INT) |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 (a IN OUT INT) | ANSI uses (INOUT param INT) |\n+-----------------------------------------+-----------------------------------+\n| AS before function body | CREATE FUNCTION f1 RETURN NUMBER |\n| | AS BEGIN... |\n+-----------------------------------------+-----------------------------------+\n| IS before function body | CREATE FUNCTION f1 RETURN NUMBER |\n| | IS BEGIN... |\n+-----------------------------------------+-----------------------------------+\n| If function has no parameters then | Example: CREATE PROCEDURE p1 AS |\n| parentheses must be omitted | BEGIN NULL; END; |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 AS BEGIN END p1; | Optional routine name after END |\n| | keyword. MDEV-12089 |\n+-----------------------------------------+-----------------------------------+\n| CREATE FUNCTION f1(a VARCHAR) | VARCHAR can be used without |\n| | length for routine parameters |\n| | and RETURN clause. The length is |\n| | inherited from the argument at |\n| | call time. MDEV-10596 |\n+-----------------------------------------+-----------------------------------+\n| CREATE AGGREGATE FUNCTION f1( ) | Creates an aggregate function, |\n| | which performs the function |\n| | against a set of rows and |\n| | returns one aggregate result. |\n+-----------------------------------------+-----------------------------------+\n| No CALL needed in Stored Procedures | In Oracle mode one can call |\n| | other stored procedures with |\n| | name only. MDEV-12107 |\n+-----------------------------------------+-----------------------------------+\n| RETURN. Can also be used in stored | ANSI uses RETURNS. MariaDB mode |\n| procedures | only supports RETURNS in stored |\n| | functions |\n+-----------------------------------------+-----------------------------------+\n\nCursors\n-------\n\nOracle mode makes the following changes to Cursors:\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 AS CURSOR cur IS | Explicit cursor with FOR loop. |\n| (SELECT a, b FROM t1); BEGIN FOR rec | MDEV-10581 |\n| IN cur ... | |\n+-----------------------------------------+-----------------------------------+\n| CREATE PROCEDURE p1 AS rec IN (SELECT | Implicit cursor with FOR loop. |\n| a, b FROM t1) | MDEV-12098 |\n+-----------------------------------------+-----------------------------------+\n| CURSOR c(prm_a VARCHAR2, prm_b | Cursor with parameters. |\n| VARCHAR2) ... OPEN c(1,2) | MDEV-10597 |\n+-----------------------------------------+-----------------------------------+\n| CURSOR c(prm_a VARCHAR2, prm_b | Cursor with parameters and FOR |\n| VARCHAR2) ... FOR rec in c(1,2) | loop. MDEV-12314 |\n+-----------------------------------------+-----------------------------------+\n| s %ISOPEN, %ROWCOUNT, %FOUND, %NOTFOUND | Explicit cursor attributes. |\n| | MDEV-10582 |\n+-----------------------------------------+-----------------------------------+\n\nLOOP\n----\n\nOracle mode makes the following changes to LOOP:\n\n+-----------------------------------------+-----------------------------------+\n| Oracle syntax | Description |\n+-----------------------------------------+-----------------------------------+\n| FOR i IN 1..10 LOOP ... END LOOP | Numeric FOR loop. MDEV-10580 |\n+-----------------------------------------+-----------------------------------+\n| GOTO | GOTO statement. MDEV-10697 |\n+-----------------------------------------+-----------------------------------+\n| <