[Commits] c07325f932a: Merge branch '10.3' into 10.4

Oleksandr Byelkin sanja at mariadb.com
Sun May 19 21:55:58 EEST 2019


revision-id: c07325f932abef2032b2e56532f6cb615e2a1161 (mariadb-10.4.4-112-gc07325f932a)
parent(s): 7f8187bc432f79afe4c0549d68845a68e6c159ab 2ae83affef5a4d89f38272db31a400f968279a7a
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2019-05-19 20:55:37 +0200
message:

Merge branch '10.3' into 10.4


 BUILD/FINISH.sh                                    |   2 +-
 BUILD/SETUP.sh                                     |   2 +-
 BUILD/autorun.sh                                   |   2 +-
 BUILD/check-cpu                                    |   2 +-
 BUILD/cleanup                                      |   2 +-
 BUILD/cmake_configure.sh                           |   2 +-
 BUILD/compile-amd64-debug-max                      |   2 +-
 BUILD/compile-amd64-gcov                           |   2 +-
 BUILD/compile-amd64-gprof                          |   2 +-
 BUILD/compile-amd64-max                            |   2 +-
 BUILD/compile-amd64-valgrind-max                   |   2 +-
 BUILD/compile-bintar                               |   2 +-
 BUILD/compile-darwin-mwcc                          |   2 +-
 BUILD/compile-dist                                 |   2 +-
 BUILD/compile-hpux11-parisc2-aCC                   |   2 +-
 BUILD/compile-irix-mips64-mipspro                  |   2 +-
 BUILD/compile-pentium-icc                          |   2 +-
 BUILD/compile-pentium-icc-yassl                    |   2 +-
 BUILD/compile-pentium32                            |   2 +-
 BUILD/compile-pentium32-cybozu                     |   2 +-
 BUILD/compile-pentium32-debug                      |   2 +-
 BUILD/compile-pentium32-debug-max                  |   2 +-
 BUILD/compile-pentium32-debug-openssl              |   2 +-
 BUILD/compile-pentium32-gcov                       |   2 +-
 BUILD/compile-pentium32-gprof                      |   2 +-
 BUILD/compile-pentium32-icc-valgrind-max           |   4 +-
 BUILD/compile-pentium32-max                        |   2 +-
 BUILD/compile-pentium32-valgrind-max               |   4 +-
 BUILD/compile-pentium64-asan-max                   |   2 +-
 BUILD/compile-pentium64-debug                      |   2 +-
 BUILD/compile-pentium64-debug-max                  |   2 +-
 BUILD/compile-pentium64-gcov                       |   2 +-
 BUILD/compile-pentium64-gprof                      |   2 +-
 BUILD/compile-pentium64-max                        |   2 +-
 BUILD/compile-pentium64-valgrind-max               |   4 +-
 BUILD/compile-pentium64-wsrep                      |   2 +-
 BUILD/compile-ppc                                  |   2 +-
 BUILD/compile-ppc-debug                            |   2 +-
 BUILD/compile-ppc-debug-max                        |   2 +-
 BUILD/compile-ppc-max                              |   2 +-
 BUILD/compile-solaris-amd64-debug                  |   2 +-
 BUILD/compile-solaris-amd64-forte                  |   2 +-
 BUILD/compile-solaris-sparc                        |   2 +-
 BUILD/compile-solaris-sparc-forte                  |   4 +-
 BUILD/util.sh                                      |   2 +-
 CMakeLists.txt                                     |  14 +-
 COPYING                                            |   4 +-
 README.md                                          |   8 +-
 COPYING.thirdparty => THIRDPARTY                   |  12 +-
 client/CMakeLists.txt                              |   2 +-
 client/client_priv.h                               |   2 +-
 client/completion_hash.cc                          |   2 +-
 client/completion_hash.h                           |   2 +-
 client/echo.c                                      |   2 +-
 client/my_readline.h                               |   2 +-
 client/mysql.cc                                    |   2 +-
 client/mysql_plugin.c                              |  10 +-
 client/mysql_upgrade.c                             |   2 +-
 client/mysqladmin.cc                               |   2 +-
 client/mysqlbinlog.cc                              |   2 +-
 client/mysqlcheck.c                                |   2 +-
 client/mysqldump.c                                 |  70 +--
 client/mysqlimport.c                               |  15 +-
 client/mysqlshow.c                                 |   2 +-
 client/mysqlslap.c                                 |   2 +-
 client/mysqltest.cc                                |   2 +-
 client/readline.cc                                 |   2 +-
 client/sql_string.cc.dontuse                       |   2 +-
 client/sql_string.h.dontuse                        |   2 +-
 cmake/abi_check.cmake                              |   2 +-
 cmake/build_configurations/mysql_release.cmake     |   2 +-
 cmake/character_sets.cmake                         |   2 +-
 cmake/compile_flags.cmake                          |   2 +-
 cmake/configure.pl                                 |   2 +-
 cmake/cpack_source_ignore_files.cmake              |   2 +-
 cmake/cpu_info.cmake                               |   2 +-
 cmake/create_initial_db.cmake                      |   2 +-
 cmake/do_abi_check.cmake                           |   2 +-
 cmake/dtrace.cmake                                 |   2 +-
 cmake/dtrace_prelink.cmake                         |   2 +-
 cmake/info_bin.cmake                               |   2 +-
 cmake/info_macros.cmake.in                         |   2 +-
 cmake/info_src.cmake                               |   2 +-
 cmake/install_layout.cmake                         |   2 +-
 cmake/install_macros.cmake                         |   2 +-
 cmake/libutils.cmake                               |   2 +-
 cmake/maintainer.cmake                             |   2 +-
 cmake/make_dist.cmake.in                           |   2 +-
 cmake/merge_archives_unix.cmake                    |   2 +-
 cmake/mysql_add_executable.cmake                   |   2 +-
 cmake/mysql_version.cmake                          |   2 +-
 cmake/os/AIX.cmake                                 |   2 +-
 cmake/os/Cygwin.cmake                              |   2 +-
 cmake/os/Darwin.cmake                              |   2 +-
 cmake/os/FreeBSD.cmake                             |   2 +-
 cmake/os/HP-UX.cmake                               |   2 +-
 cmake/os/Linux.cmake                               |   2 +-
 cmake/os/OS400.cmake                               |   2 +-
 cmake/os/SunOS.cmake                               |   2 +-
 cmake/os/Windows.cmake                             |   2 +-
 cmake/os/WindowsCache.cmake                        |   2 +-
 cmake/package_name.cmake                           |   2 +-
 cmake/plugin.cmake                                 |   2 +-
 cmake/readline.cmake                               |   2 +-
 cmake/ssl.cmake                                    |   2 +-
 cmake/stack_direction.c                            |   2 +-
 cmake/systemd.cmake                                |   2 +-
 cmake/tags.cmake                                   |   2 +-
 cmake/versioninfo.rc.in                            |   2 +-
 cmake/wsrep.cmake                                  |   2 +-
 cmake/zlib.cmake                                   |   2 +-
 config.h.cmake                                     |   2 +-
 configure.cmake                                    |   2 +-
 dbug/CMakeLists.txt                                |   2 +-
 dbug/dbug_add_tags.pl                              |   2 +-
 debian/additions/innotop/innotop                   |   6 +-
 debian/additions/innotop/innotop.1                 |   2 +-
 debian/copyright                                   |   2 +-
 extra/CMakeLists.txt                               |   2 +-
 extra/charset2html.c                               |   2 +-
 extra/comp_err.c                                   |   2 +-
 extra/innochecksum.cc                              |   2 +-
 extra/mariabackup/CMakeLists.txt                   |   2 +-
 extra/mariabackup/backup_copy.cc                   |   6 +-
 extra/mariabackup/backup_mysql.cc                  |   6 +-
 extra/mariabackup/backup_wsrep.h                   |   2 +-
 extra/mariabackup/changed_page_bitmap.cc           |   2 +-
 extra/mariabackup/changed_page_bitmap.h            |   2 +-
 extra/mariabackup/common.h                         |   2 +-
 extra/mariabackup/crc/CMakeLists.txt               |   2 +-
 extra/mariabackup/crc/config.h.cmake               |   2 +-
 extra/mariabackup/crc/crc-intel-pclmul.c           |   4 +-
 extra/mariabackup/crc/crc-intel-pclmul.h           |   2 +-
 extra/mariabackup/crc/crc_glue.c                   |   2 +-
 extra/mariabackup/crc/crc_glue.h                   |   2 +-
 extra/mariabackup/datasink.cc                      |   2 +-
 extra/mariabackup/datasink.h                       |   2 +-
 extra/mariabackup/ds_archive.cc                    |   2 +-
 extra/mariabackup/ds_archive.h                     |   2 +-
 extra/mariabackup/ds_buffer.cc                     |   2 +-
 extra/mariabackup/ds_buffer.h                      |   2 +-
 extra/mariabackup/ds_compress.cc                   |   2 +-
 extra/mariabackup/ds_compress.h                    |   2 +-
 extra/mariabackup/ds_local.cc                      |   2 +-
 extra/mariabackup/ds_local.h                       |   2 +-
 extra/mariabackup/ds_stdout.cc                     |   2 +-
 extra/mariabackup/ds_stdout.h                      |   2 +-
 extra/mariabackup/ds_tmpfile.cc                    |   2 +-
 extra/mariabackup/ds_tmpfile.h                     |   2 +-
 extra/mariabackup/ds_xbstream.cc                   |   2 +-
 extra/mariabackup/ds_xbstream.h                    |   2 +-
 extra/mariabackup/fil_cur.cc                       |   2 +-
 extra/mariabackup/fil_cur.h                        |   2 +-
 extra/mariabackup/innobackupex.cc                  |   6 +-
 extra/mariabackup/innobackupex.h                   |   2 +-
 extra/mariabackup/read_filt.cc                     |   2 +-
 extra/mariabackup/read_filt.h                      |   2 +-
 extra/mariabackup/write_filt.cc                    |   2 +-
 extra/mariabackup/write_filt.h                     |   2 +-
 extra/mariabackup/wsrep.cc                         |   4 +-
 extra/mariabackup/xb_regex.h                       |   2 +-
 extra/mariabackup/xbcloud.cc                       |   2 +-
 extra/mariabackup/xbstream.cc                      |   2 +-
 extra/mariabackup/xbstream.h                       |   2 +-
 extra/mariabackup/xbstream_read.cc                 |   2 +-
 extra/mariabackup/xbstream_write.cc                |   2 +-
 extra/mariabackup/xtrabackup.cc                    |   6 +-
 extra/mariabackup/xtrabackup.h                     |   2 +-
 extra/my_print_defaults.c                          |   2 +-
 extra/mysql_waitpid.c                              |   2 +-
 extra/perror.c                                     |   2 +-
 extra/readline/CMakeLists.txt                      |   2 +-
 extra/readline/COPYING                             |   4 +-
 extra/readline/ansi_stdlib.h                       |   2 +-
 extra/readline/bind.c                              |   2 +-
 extra/readline/callback.c                          |   2 +-
 extra/readline/chardefs.h                          |   2 +-
 extra/readline/compat.c                            |   2 +-
 extra/readline/complete.c                          |   2 +-
 extra/readline/configure.in                        |   2 +-
 extra/readline/display.c                           |   2 +-
 extra/readline/emacs_keymap.c                      |   2 +-
 extra/readline/funmap.c                            |   2 +-
 extra/readline/histexpand.c                        |   2 +-
 extra/readline/histfile.c                          |   2 +-
 extra/readline/histlib.h                           |   2 +-
 extra/readline/history.c                           |   2 +-
 extra/readline/history.h                           |   2 +-
 extra/readline/histsearch.c                        |   2 +-
 extra/readline/input.c                             |   2 +-
 extra/readline/isearch.c                           |   2 +-
 extra/readline/keymaps.c                           |   2 +-
 extra/readline/keymaps.h                           |   2 +-
 extra/readline/kill.c                              |   2 +-
 extra/readline/macro.c                             |   2 +-
 extra/readline/mbutil.c                            |   2 +-
 extra/readline/misc.c                              |   2 +-
 extra/readline/nls.c                               |   2 +-
 extra/readline/parens.c                            |   2 +-
 extra/readline/posixdir.h                          |   2 +-
 extra/readline/posixjmp.h                          |   2 +-
 extra/readline/posixstat.h                         |   2 +-
 extra/readline/readline.c                          |   2 +-
 extra/readline/readline.h                          |   2 +-
 extra/readline/rlconf.h                            |   2 +-
 extra/readline/rldefs.h                            |   2 +-
 extra/readline/rlmbutil.h                          |   2 +-
 extra/readline/rlprivate.h                         |   2 +-
 extra/readline/rlshell.h                           |   2 +-
 extra/readline/rlstdc.h                            |   2 +-
 extra/readline/rltty.c                             |   2 +-
 extra/readline/rltty.h                             |   2 +-
 extra/readline/rltypedefs.h                        |   2 +-
 extra/readline/rlwinsize.h                         |   2 +-
 extra/readline/savestring.c                        |   2 +-
 extra/readline/search.c                            |   2 +-
 extra/readline/shell.c                             |   2 +-
 extra/readline/signals.c                           |   2 +-
 extra/readline/tcap.h                              |   2 +-
 extra/readline/terminal.c                          |   2 +-
 extra/readline/text.c                              |   2 +-
 extra/readline/tilde.c                             |   2 +-
 extra/readline/tilde.h                             |   2 +-
 extra/readline/undo.c                              |   2 +-
 extra/readline/util.c                              |   2 +-
 extra/readline/vi_keymap.c                         |   2 +-
 extra/readline/vi_mode.c                           |   2 +-
 extra/readline/xmalloc.c                           |   2 +-
 extra/readline/xmalloc.h                           |   2 +-
 extra/replace.c                                    |   2 +-
 extra/resolve_stack_dump.c                         |   2 +-
 extra/resolveip.c                                  |   2 +-
 extra/yassl/CMakeLists.txt                         |   2 +-
 extra/yassl/COPYING                                |   4 +-
 extra/yassl/examples/client/client.cpp             |   2 +-
 extra/yassl/examples/echoclient/echoclient.cpp     |   2 +-
 extra/yassl/examples/echoserver/echoserver.cpp     |   2 +-
 extra/yassl/examples/server/server.cpp             |   2 +-
 extra/yassl/include/buffer.hpp                     |   2 +-
 extra/yassl/include/cert_wrapper.hpp               |   2 +-
 extra/yassl/include/crypto_wrapper.hpp             |   2 +-
 extra/yassl/include/factory.hpp                    |   2 +-
 extra/yassl/include/handshake.hpp                  |   2 +-
 extra/yassl/include/lock.hpp                       |   2 +-
 extra/yassl/include/log.hpp                        |   2 +-
 extra/yassl/include/openssl/crypto.h               |   2 +-
 extra/yassl/include/openssl/des.h                  |   2 +-
 extra/yassl/include/openssl/des_old.h              |   2 +-
 extra/yassl/include/openssl/engine.h               |   2 +-
 extra/yassl/include/openssl/err.h                  |   2 +-
 extra/yassl/include/openssl/evp.h                  |   2 +-
 .../yassl/include/openssl/generate_prefix_files.pl |   2 +-
 extra/yassl/include/openssl/hmac.h                 |   2 +-
 extra/yassl/include/openssl/lhash.h                |   2 +-
 extra/yassl/include/openssl/md4.h                  |   2 +-
 extra/yassl/include/openssl/md5.h                  |   2 +-
 extra/yassl/include/openssl/objects.h              |   2 +-
 extra/yassl/include/openssl/opensslv.h             |   2 +-
 extra/yassl/include/openssl/pem.h                  |   2 +-
 extra/yassl/include/openssl/pkcs12.h               |   2 +-
 extra/yassl/include/openssl/prefix_crypto.h        |   2 +-
 extra/yassl/include/openssl/prefix_ssl.h           |   2 +-
 extra/yassl/include/openssl/rand.h                 |   2 +-
 extra/yassl/include/openssl/rsa.h                  |   2 +-
 extra/yassl/include/openssl/sha.h                  |   2 +-
 extra/yassl/include/openssl/ssl.h                  |   2 +-
 extra/yassl/include/openssl/transport_types.h      |   2 +-
 extra/yassl/include/openssl/x509.h                 |   2 +-
 extra/yassl/include/openssl/x509v3.h               |   2 +-
 extra/yassl/include/socket_wrapper.hpp             |   2 +-
 extra/yassl/include/timer.hpp                      |   2 +-
 extra/yassl/include/yassl.hpp                      |   2 +-
 extra/yassl/include/yassl_error.hpp                |   2 +-
 extra/yassl/include/yassl_imp.hpp                  |   2 +-
 extra/yassl/include/yassl_int.hpp                  |   2 +-
 extra/yassl/include/yassl_types.hpp                |   2 +-
 extra/yassl/src/buffer.cpp                         |   2 +-
 extra/yassl/src/cert_wrapper.cpp                   |   2 +-
 extra/yassl/src/crypto_wrapper.cpp                 |   2 +-
 extra/yassl/src/handshake.cpp                      |   2 +-
 extra/yassl/src/lock.cpp                           |   2 +-
 extra/yassl/src/log.cpp                            |   2 +-
 extra/yassl/src/make.bat                           |   2 +-
 extra/yassl/src/socket_wrapper.cpp                 |   2 +-
 extra/yassl/src/ssl.cpp                            |   2 +-
 extra/yassl/src/timer.cpp                          |   2 +-
 extra/yassl/src/yassl.cpp                          |   2 +-
 extra/yassl/src/yassl_error.cpp                    |   2 +-
 extra/yassl/src/yassl_imp.cpp                      |   2 +-
 extra/yassl/src/yassl_int.cpp                      |   2 +-
 extra/yassl/taocrypt/CMakeLists.txt                |   2 +-
 extra/yassl/taocrypt/COPYING                       |   4 +-
 extra/yassl/taocrypt/benchmark/benchmark.cpp       |   2 +-
 extra/yassl/taocrypt/benchmark/make.bat            |   2 +-
 extra/yassl/taocrypt/include/aes.hpp               |   2 +-
 extra/yassl/taocrypt/include/algebra.hpp           |   2 +-
 extra/yassl/taocrypt/include/arc4.hpp              |   2 +-
 extra/yassl/taocrypt/include/asn.hpp               |   2 +-
 extra/yassl/taocrypt/include/block.hpp             |   2 +-
 extra/yassl/taocrypt/include/blowfish.hpp          |   2 +-
 extra/yassl/taocrypt/include/coding.hpp            |   2 +-
 extra/yassl/taocrypt/include/des.hpp               |   2 +-
 extra/yassl/taocrypt/include/dh.hpp                |   2 +-
 extra/yassl/taocrypt/include/dsa.hpp               |   2 +-
 extra/yassl/taocrypt/include/error.hpp             |   2 +-
 extra/yassl/taocrypt/include/file.hpp              |   2 +-
 extra/yassl/taocrypt/include/hash.hpp              |   2 +-
 extra/yassl/taocrypt/include/hc128.hpp             |   2 +-
 extra/yassl/taocrypt/include/hmac.hpp              |   2 +-
 extra/yassl/taocrypt/include/integer.hpp           |   2 +-
 extra/yassl/taocrypt/include/kernelc.hpp           |   2 +-
 extra/yassl/taocrypt/include/md2.hpp               |   2 +-
 extra/yassl/taocrypt/include/md4.hpp               |   2 +-
 extra/yassl/taocrypt/include/md5.hpp               |   2 +-
 extra/yassl/taocrypt/include/misc.hpp              |   2 +-
 extra/yassl/taocrypt/include/modarith.hpp          |   2 +-
 extra/yassl/taocrypt/include/modes.hpp             |   2 +-
 extra/yassl/taocrypt/include/pwdbased.hpp          |   2 +-
 extra/yassl/taocrypt/include/rabbit.hpp            |   2 +-
 extra/yassl/taocrypt/include/random.hpp            |   2 +-
 extra/yassl/taocrypt/include/ripemd.hpp            |   2 +-
 extra/yassl/taocrypt/include/rsa.hpp               |   2 +-
 extra/yassl/taocrypt/include/runtime.hpp           |   2 +-
 extra/yassl/taocrypt/include/sha.hpp               |   2 +-
 extra/yassl/taocrypt/include/twofish.hpp           |   2 +-
 extra/yassl/taocrypt/include/type_traits.hpp       |   2 +-
 extra/yassl/taocrypt/include/types.hpp             |   2 +-
 extra/yassl/taocrypt/mySTL/algorithm.hpp           |   2 +-
 extra/yassl/taocrypt/mySTL/helpers.hpp             |   2 +-
 extra/yassl/taocrypt/mySTL/list.hpp                |   2 +-
 extra/yassl/taocrypt/mySTL/memory.hpp              |   2 +-
 extra/yassl/taocrypt/mySTL/memory_array.hpp        |   2 +-
 extra/yassl/taocrypt/mySTL/pair.hpp                |   2 +-
 extra/yassl/taocrypt/mySTL/stdexcept.hpp           |   2 +-
 extra/yassl/taocrypt/mySTL/vector.hpp              |   2 +-
 extra/yassl/taocrypt/src/aes.cpp                   |   2 +-
 extra/yassl/taocrypt/src/aestables.cpp             |   2 +-
 extra/yassl/taocrypt/src/algebra.cpp               |   2 +-
 extra/yassl/taocrypt/src/arc4.cpp                  |   2 +-
 extra/yassl/taocrypt/src/asn.cpp                   |   2 +-
 extra/yassl/taocrypt/src/bftables.cpp              |   2 +-
 extra/yassl/taocrypt/src/blowfish.cpp              |   2 +-
 extra/yassl/taocrypt/src/coding.cpp                |   2 +-
 extra/yassl/taocrypt/src/des.cpp                   |   2 +-
 extra/yassl/taocrypt/src/dh.cpp                    |   2 +-
 extra/yassl/taocrypt/src/dsa.cpp                   |   2 +-
 extra/yassl/taocrypt/src/file.cpp                  |   2 +-
 extra/yassl/taocrypt/src/hash.cpp                  |   2 +-
 extra/yassl/taocrypt/src/hc128.cpp                 |   2 +-
 extra/yassl/taocrypt/src/integer.cpp               |   2 +-
 extra/yassl/taocrypt/src/make.bat                  |   2 +-
 extra/yassl/taocrypt/src/md2.cpp                   |   2 +-
 extra/yassl/taocrypt/src/md4.cpp                   |   2 +-
 extra/yassl/taocrypt/src/md5.cpp                   |   2 +-
 extra/yassl/taocrypt/src/misc.cpp                  |   2 +-
 extra/yassl/taocrypt/src/rabbit.cpp                |   2 +-
 extra/yassl/taocrypt/src/random.cpp                |   2 +-
 extra/yassl/taocrypt/src/ripemd.cpp                |   2 +-
 extra/yassl/taocrypt/src/rsa.cpp                   |   2 +-
 extra/yassl/taocrypt/src/sha.cpp                   |   2 +-
 extra/yassl/taocrypt/src/tftables.cpp              |   2 +-
 extra/yassl/taocrypt/src/twofish.cpp               |   2 +-
 extra/yassl/taocrypt/test/make.bat                 |   2 +-
 extra/yassl/taocrypt/test/memory.cpp               |   2 +-
 extra/yassl/taocrypt/test/test.cpp                 |   2 +-
 extra/yassl/testsuite/make.bat                     |   2 +-
 extra/yassl/testsuite/test.hpp                     |   2 +-
 extra/yassl/testsuite/testsuite.cpp                |   2 +-
 include/CMakeLists.txt                             |   2 +-
 include/atomic/gcc_builtins.h                      |   2 +-
 include/atomic/generic-msvc.h                      |   2 +-
 include/atomic/solaris.h                           |   2 +-
 include/big_endian.h                               |   2 +-
 include/byte_order_generic.h                       |   2 +-
 include/byte_order_generic_x86.h                   |   2 +-
 include/byte_order_generic_x86_64.h                |   2 +-
 include/decimal.h                                  |   2 +-
 include/errmsg.h                                   |   2 +-
 include/ft_global.h                                |   2 +-
 include/handler_ername.h                           |   2 +-
 include/hash.h                                     |   2 +-
 include/heap.h                                     |   2 +-
 include/keycache.h                                 |   2 +-
 include/lf.h                                       |   2 +-
 include/little_endian.h                            |   2 +-
 include/m_ctype.h                                  |   2 +-
 include/m_string.h                                 |   2 +-
 include/maria.h                                    |   2 +-
 include/my_alarm.h                                 |   2 +-
 include/my_alloc.h                                 |   2 +-
 include/my_atomic.h                                |   2 +-
 include/my_attribute.h                             |   2 +-
 include/my_base.h                                  |   2 +-
 include/my_bit.h                                   |   2 +-
 include/my_bitmap.h                                |   2 +-
 include/my_byteorder.h                             |   2 +-
 include/my_check_opt.h                             |   2 +-
 include/my_compare.h                               |   2 +-
 include/my_compiler.h                              |   2 +-
 include/my_cpu.h                                   |   2 +-
 include/my_crypt.h                                 |   2 +-
 include/my_dbug.h                                  |   2 +-
 include/my_decimal_limits.h                        |   2 +-
 include/my_default.h                               |   2 +-
 include/my_dir.h                                   |   2 +-
 include/my_getopt.h                                |   2 +-
 include/my_global.h                                |   2 +-
 include/my_handler_errors.h                        |   2 +-
 include/my_libwrap.h                               |   2 +-
 include/my_list.h                                  |   2 +-
 include/my_md5.h                                   |   2 +-
 include/my_net.h                                   |   2 +-
 include/my_nosys.h                                 |   2 +-
 include/my_pthread.h                               |  24 +-
 include/my_rdtsc.h                                 |   2 +-
 include/my_rnd.h                                   |   2 +-
 include/my_service_manager.h                       |   2 +-
 include/my_stacktrace.h                            |   2 +-
 include/my_sys.h                                   |   5 +-
 include/my_time.h                                  |   2 +-
 include/my_tree.h                                  |   4 +-
 include/my_uctype.h                                |   2 +-
 include/my_user.h                                  |   2 +-
 include/my_valgrind.h                              |   4 +-
 include/my_xml.h                                   |   2 +-
 include/myisam.h                                   |   2 +-
 include/myisamchk.h                                |   2 +-
 include/myisammrg.h                                |   2 +-
 include/myisampack.h                               |   2 +-
 include/mysql.h                                    |   2 +-
 include/mysql/auth_dialog_client.h                 |   2 +-
 include/mysql/client_plugin.h                      |   2 +-
 include/mysql/plugin.h                             |   2 +-
 include/mysql/plugin_audit.h                       |   2 +-
 include/mysql/plugin_auth.h                        |   2 +-
 include/mysql/plugin_auth_common.h                 |   2 +-
 include/mysql/plugin_encryption.h                  |   2 +-
 include/mysql/plugin_ftparser.h                    |   2 +-
 include/mysql/plugin_password_validation.h         |   2 +-
 include/mysql/psi/mysql_file.h                     |   2 +-
 include/mysql/psi/mysql_idle.h                     |   2 +-
 include/mysql/psi/mysql_socket.h                   |   2 +-
 include/mysql/psi/mysql_stage.h                    |   2 +-
 include/mysql/psi/mysql_statement.h                |   2 +-
 include/mysql/psi/mysql_table.h                    |   2 +-
 include/mysql/psi/mysql_thread.h                   |   2 +-
 include/mysql/psi/psi.h                            |   2 +-
 include/mysql/psi/psi_abi_v0.h                     |   2 +-
 include/mysql/psi/psi_abi_v1.h                     |   2 +-
 include/mysql/psi/psi_abi_v2.h                     |   2 +-
 include/mysql/psi/psi_base.h                       |   2 +-
 include/mysql/psi/psi_memory.h                     |   2 +-
 include/mysql/service_base64.h                     |   2 +-
 include/mysql/service_debug_sync.h                 |   2 +-
 include/mysql/service_encryption.h                 |   2 +-
 include/mysql/service_encryption_scheme.h          |   2 +-
 include/mysql/service_kill_statement.h             |   2 +-
 include/mysql/service_logger.h                     |   2 +-
 include/mysql/service_md5.h                        |   2 +-
 include/mysql/service_my_crypt.h                   |   2 +-
 include/mysql/service_my_print_error.h             |   2 +-
 include/mysql/service_my_snprintf.h                |   2 +-
 include/mysql/service_progress_report.h            |   2 +-
 include/mysql/service_sha1.h                       |   2 +-
 include/mysql/service_sha2.h                       |   2 +-
 include/mysql/service_thd_alloc.h                  |   2 +-
 include/mysql/service_thd_autoinc.h                |   2 +-
 include/mysql/service_thd_error_context.h          |   2 +-
 include/mysql/service_thd_rnd.h                    |   2 +-
 include/mysql/service_thd_specifics.h              |   2 +-
 include/mysql/service_thd_timezone.h               |   2 +-
 include/mysql/service_thd_wait.h                   |   2 +-
 include/mysql/service_wsrep.h                      |   2 +-
 include/mysql/services.h                           |   2 +-
 include/mysql_async.h                              |   2 +-
 include/mysql_com.h                                |   2 +-
 include/mysql_com_server.h                         |   2 +-
 include/mysql_embed.h                              |   2 +-
 include/mysql_time.h                               |   2 +-
 include/mysys_err.h                                |   2 +-
 include/password.h                                 |   2 +-
 include/probes_mysql.d.base                        |   2 +-
 include/probes_mysql.h                             |   2 +-
 include/rijndael.h                                 |   2 +-
 include/service_versions.h                         |   2 +-
 include/sql_common.h                               |   2 +-
 include/sslopt-case.h                              |   2 +-
 include/sslopt-longopts.h                          |   2 +-
 include/sslopt-vars.h                              |   2 +-
 include/t_ctype.h                                  |   2 +-
 include/thr_alarm.h                                |   2 +-
 include/thr_lock.h                                 |   2 +-
 include/thr_timer.h                                |   2 +-
 include/thread_pool_priv.h                         |   2 +-
 include/typelib.h                                  |   2 +-
 include/violite.h                                  |   4 +-
 include/waiting_threads.h                          |   2 +-
 include/welcome_copyright_notice.h                 |   2 +-
 include/wqueue.h                                   |   2 +-
 include/wsrep.h                                    |   2 +-
 libmysqld/CMakeLists.txt                           |   2 +-
 libmysqld/client_settings.h                        |   2 +-
 libmysqld/emb_qcache.cc                            |   2 +-
 libmysqld/emb_qcache.h                             |   2 +-
 libmysqld/embedded_priv.h                          |   2 +-
 libmysqld/examples/CMakeLists.txt                  |   2 +-
 libmysqld/examples/builder-sample/emb_sample.bpr   |   2 +-
 libmysqld/examples/builder-sample/emb_sample.cpp   |   2 +-
 libmysqld/examples/builder-sample/emb_samples.cpp  |   2 +-
 libmysqld/examples/builder-sample/emb_samples.h    |   2 +-
 libmysqld/examples/test-run                        |   2 +-
 libmysqld/libmysql.c                               |   2 +-
 libmysqld/libmysqld.c                              |   2 +-
 libservices/CMakeLists.txt                         |   2 +-
 libservices/base64_service.c                       |   2 +-
 libservices/debug_sync_service.c                   |   2 +-
 libservices/encryption_scheme_service.c            |   2 +-
 libservices/encryption_service.c                   |   2 +-
 libservices/kill_statement_service.c               |   2 +-
 libservices/logger_service.c                       |   2 +-
 libservices/my_md5_service.c                       |   2 +-
 libservices/my_print_error_service.c               |   2 +-
 libservices/my_sha1_service.c                      |   2 +-
 libservices/my_sha2_service.c                      |   2 +-
 libservices/my_snprintf_service.c                  |   2 +-
 libservices/progress_report_service.c              |   2 +-
 libservices/thd_alloc_service.c                    |   2 +-
 libservices/thd_autoinc_service.c                  |   2 +-
 libservices/thd_error_context_service.c            |   2 +-
 libservices/thd_rnd_service.c                      |   2 +-
 libservices/thd_specifics_service.c                |   2 +-
 libservices/thd_timezone_service.c                 |   2 +-
 libservices/thd_wait_service.c                     |   2 +-
 libservices/wsrep_service.c                        |   2 +-
 man/CMakeLists.txt                                 |   2 +-
 man/comp_err.1                                     |   2 +-
 man/innochecksum.1                                 |   2 +-
 man/msql2mysql.1                                   |   2 +-
 man/my_print_defaults.1                            |   2 +-
 man/myisam_ftdump.1                                |   2 +-
 man/myisamchk.1                                    |   2 +-
 man/myisamlog.1                                    |   2 +-
 man/myisampack.1                                   |   2 +-
 man/mysql-stress-test.pl.1                         |   2 +-
 man/mysql-test-run.pl.1                            |   2 +-
 man/mysql.1                                        |   2 +-
 man/mysql.server.1                                 |   2 +-
 man/mysql_client_test.1                            |   2 +-
 man/mysql_config.1                                 |   2 +-
 man/mysql_convert_table_format.1                   |   2 +-
 man/mysql_find_rows.1                              |   2 +-
 man/mysql_fix_extensions.1                         |   2 +-
 man/mysql_install_db.1                             |   2 +-
 man/mysql_plugin.1                                 |   2 +-
 man/mysql_secure_installation.1                    |   2 +-
 man/mysql_setpermission.1                          |   2 +-
 man/mysql_tzinfo_to_sql.1                          |   2 +-
 man/mysql_upgrade.1                                |   2 +-
 man/mysql_waitpid.1                                |   2 +-
 man/mysqlaccess.1                                  |   2 +-
 man/mysqladmin.1                                   |   2 +-
 man/mysqlbinlog.1                                  |   2 +-
 man/mysqlcheck.1                                   |   2 +-
 man/mysqld.8                                       |   2 +-
 man/mysqld_multi.1                                 |   2 +-
 man/mysqld_safe.1                                  |   2 +-
 man/mysqldump.1                                    |   2 +-
 man/mysqldumpslow.1                                |   2 +-
 man/mysqlhotcopy.1                                 |   2 +-
 man/mysqlimport.1                                  |   2 +-
 man/mysqlshow.1                                    |   2 +-
 man/mysqlslap.1                                    |   2 +-
 man/mysqltest.1                                    |   2 +-
 man/perror.1                                       |   2 +-
 man/replace.1                                      |   2 +-
 man/resolve_stack_dump.1                           |   2 +-
 man/resolveip.1                                    |   2 +-
 man/tokuftdump.1                                   |   2 +-
 mysql-test/CMakeLists.txt                          |   2 +-
 mysql-test/dgcov.pl                                |   2 +-
 mysql-test/include/ctype_like_escape.inc           |   6 +
 mysql-test/include/default_my.cnf                  |   2 +-
 mysql-test/include/default_mysqld.cnf              |   2 +-
 mysql-test/include/have_perfschema.inc             |   2 +-
 mysql-test/include/mtr_check.sql                   |   2 +-
 mysql-test/include/mtr_warnings.sql                |   2 +-
 mysql-test/include/set_binlog_format_mixed.sql     |   2 +-
 mysql-test/include/set_binlog_format_row.sql       |   2 +-
 mysql-test/include/set_binlog_format_statement.sql |   2 +-
 mysql-test/lib/My/Config.pm                        |   2 +-
 mysql-test/lib/My/ConfigFactory.pm                 |   2 +-
 mysql-test/lib/My/CoreDump.pm                      |   2 +-
 mysql-test/lib/My/File/Path.pm                     |   2 +-
 mysql-test/lib/My/Find.pm                          |   2 +-
 mysql-test/lib/My/Handles.pm                       |   2 +-
 mysql-test/lib/My/Options.pm                       |   2 +-
 mysql-test/lib/My/Platform.pm                      |   2 +-
 mysql-test/lib/My/SafeProcess.pm                   |   2 +-
 mysql-test/lib/My/SafeProcess/Base.pm              |   2 +-
 mysql-test/lib/My/SafeProcess/CMakeLists.txt       |   2 +-
 mysql-test/lib/My/SafeProcess/safe_kill_win.cc     |   2 +-
 mysql-test/lib/My/SafeProcess/safe_process.cc      |   2 +-
 mysql-test/lib/My/SafeProcess/safe_process_win.cc  |   2 +-
 mysql-test/lib/My/SysInfo.pm                       |   2 +-
 mysql-test/lib/My/Test.pm                          |   2 +-
 mysql-test/lib/generate-ssl-certs.sh               |   2 +-
 mysql-test/lib/mtr_cases.pm                        |   2 +-
 mysql-test/lib/mtr_gprof.pl                        |   2 +-
 mysql-test/lib/mtr_io.pl                           |   2 +-
 mysql-test/lib/mtr_match.pm                        |   2 +-
 mysql-test/lib/mtr_misc.pl                         |   2 +-
 mysql-test/lib/mtr_process.pl                      |   2 +-
 mysql-test/lib/mtr_report.pm                       |   2 +-
 mysql-test/lib/mtr_results.pm                      |   2 +-
 mysql-test/lib/mtr_stress.pl                       |   2 +-
 mysql-test/lib/mtr_unique.pm                       |   2 +-
 mysql-test/lib/t/Base.t                            |   2 +-
 mysql-test/lib/t/Find.t                            |   2 +-
 mysql-test/lib/t/Options.t                         |   2 +-
 mysql-test/lib/t/Platform.t                        |   2 +-
 mysql-test/lib/t/SafeProcess.t                     |   2 +-
 mysql-test/lib/t/SafeProcessStress.pl              |   2 +-
 mysql-test/lib/t/copytree.t                        |   2 +-
 mysql-test/lib/t/dummyd.pl                         |   2 +-
 mysql-test/lib/t/rmtree.t                          |   2 +-
 mysql-test/lib/t/testMyConfig.t                    |   2 +-
 mysql-test/lib/t/testMyConfigFactory.t             |   2 +-
 mysql-test/lib/t/test_child.pl                     |   2 +-
 mysql-test/lib/v1/My/Config.pm                     |   2 +-
 mysql-test/lib/v1/mtr_cases.pl                     |   2 +-
 mysql-test/lib/v1/mtr_gcov.pl                      |   2 +-
 mysql-test/lib/v1/mtr_gprof.pl                     |   2 +-
 mysql-test/lib/v1/mtr_im.pl                        |   2 +-
 mysql-test/lib/v1/mtr_io.pl                        |   2 +-
 mysql-test/lib/v1/mtr_match.pl                     |   2 +-
 mysql-test/lib/v1/mtr_misc.pl                      |   2 +-
 mysql-test/lib/v1/mtr_process.pl                   |   2 +-
 mysql-test/lib/v1/mtr_report.pl                    |   2 +-
 mysql-test/lib/v1/mtr_stress.pl                    |   2 +-
 mysql-test/lib/v1/mtr_timer.pl                     |   2 +-
 mysql-test/lib/v1/mtr_unique.pl                    |   2 +-
 mysql-test/lib/v1/mysql-test-run.pl                |   2 +-
 mysql-test/main/bootstrap.test                     |  13 +-
 mysql-test/main/cast.result                        |   4 +-
 mysql-test/main/create_drop_binlog.result          |   4 +
 mysql-test/main/create_drop_event.result           |   5 +
 mysql-test/main/ctype_big5.result                  |  12 +
 mysql-test/main/ctype_euckr.result                 |  12 +
 mysql-test/main/ctype_gb2312.result                |  12 +
 mysql-test/main/ctype_gbk.result                   |  12 +
 mysql-test/main/ctype_latin1.result                |  12 +
 mysql-test/main/ctype_sjis.result                  |  12 +
 mysql-test/main/ctype_tis620.result                |  12 +
 mysql-test/main/ctype_uca.result                   |   6 +
 mysql-test/main/ctype_ucs.result                   |  12 +
 mysql-test/main/ctype_ujis.result                  |  12 +
 mysql-test/main/ctype_utf16.result                 |  12 +
 mysql-test/main/ctype_utf16_uca.result             |   6 +
 mysql-test/main/ctype_utf16le.result               |  12 +
 mysql-test/main/ctype_utf32.result                 |  12 +
 mysql-test/main/ctype_utf32_uca.result             |   6 +
 mysql-test/main/ctype_utf8.result                  |  12 +
 mysql-test/main/ctype_utf8mb4.result               |  12 +
 mysql-test/main/ctype_utf8mb4_heap.result          |  12 +
 mysql-test/main/ctype_utf8mb4_innodb.result        |  12 +
 mysql-test/main/ctype_utf8mb4_myisam.result        |  12 +
 mysql-test/main/ddl_i18n_koi8r.result              |   8 +
 mysql-test/main/ddl_i18n_utf8.result               |   8 +
 mysql-test/main/derived_cond_pushdown.result       |  52 +-
 mysql-test/main/derived_cond_pushdown.test         |  14 +
 mysql-test/main/dyncol.result                      |   4 +-
 mysql-test/main/events_1.result                    |  68 +++
 mysql-test/main/events_2.result                    |  30 +
 mysql-test/main/events_bugs.result                 |  54 ++
 mysql-test/main/events_grant.result                |  10 +
 mysql-test/main/events_restart.result              |  26 +-
 mysql-test/main/events_stress.test                 |   1 +
 mysql-test/main/events_trans.result                |   9 +
 mysql-test/main/flush_logs_not_windows.result      |   3 +
 mysql-test/main/flush_logs_not_windows.test        |  13 +
 mysql-test/main/flush_read_lock.result             |   2 +
 mysql-test/main/func_gconcat.result                |  30 +-
 mysql-test/main/func_gconcat.test                  |  33 +-
 mysql-test/main/func_hybrid_type.result            |  30 +
 mysql-test/main/func_hybrid_type.test              |  20 +
 mysql-test/main/func_json.result                   |  75 ++-
 mysql-test/main/func_json.test                     |  43 ++
 mysql-test/main/func_str.result                    |  38 ++
 mysql-test/main/func_str.test                      |  36 ++
 mysql-test/main/gis.result                         |  34 +-
 mysql-test/main/gis.test                           |  41 +-
 mysql-test/main/gis2.result                        |  38 --
 mysql-test/main/gis2.test                          |  45 --
 mysql-test/main/gis_notembedded.result             |  45 ++
 mysql-test/main/gis_notembedded.test               |  24 +
 mysql-test/main/grant4.result                      |  21 +
 mysql-test/main/grant4.test                        |  35 +-
 mysql-test/main/information_schema_prepare.result  |   4 +
 mysql-test/main/information_schema_prepare.test    |   7 +
 mysql-test/main/lock_sync.result                   |   4 +
 mysql-test/main/mdev_19276.result                  |  11 +
 mysql-test/main/mdev_19276.test                    |  17 +
 mysql-test/main/multi_update.result                |  23 +
 mysql-test/main/multi_update.test                  |  31 +
 ...lti_update2-master.opt => multi_update_big.opt} |   0
 ...ulti_update2.result => multi_update_big.result} |   0
 .../{multi_update2.test => multi_update_big.test}  |   0
 mysql-test/main/mysqldump-compat.result            |   4 +
 mysql-test/main/mysqldump-compat.test              |  13 +
 mysql-test/main/mysqldump.result                   |  34 ++
 mysql-test/main/mysqldump.test                     |  29 +
 mysql-test/main/partition_innodb.result            |  42 ++
 mysql-test/main/partition_innodb.test              |  25 +
 mysql-test/main/ps.result                          |  23 +
 mysql-test/main/ps.test                            |  16 +
 mysql-test/main/select.result                      |  14 +-
 mysql-test/main/select_jcl6.result                 |  14 +-
 mysql-test/main/select_pkeycache.result            |  14 +-
 mysql-test/main/show_check.result                  |   4 +
 mysql-test/main/sp_notembedded.result              |   2 +
 mysql-test/main/ssl_verify_ip.opt                  |   3 +
 mysql-test/main/ssl_verify_ip.result               |   4 +
 mysql-test/main/ssl_verify_ip.test                 |   3 +
 mysql-test/main/stat_tables.result                 |  48 ++
 mysql-test/main/stat_tables.test                   |  47 ++
 mysql-test/main/stat_tables_innodb.result          |  48 ++
 mysql-test/main/statistics.result                  |  14 +
 mysql-test/main/statistics.test                    |  15 +
 mysql-test/main/status2.result                     |   4 +-
 mysql-test/main/status2.test                       |   4 +-
 mysql-test/main/table_value_constr.result          | 397 ++++++++++++
 mysql-test/main/table_value_constr.test            | 193 ++++++
 mysql-test/main/temp_table.result                  |  12 +
 mysql-test/main/temp_table.test                    |  16 +
 mysql-test/main/timezone2.result                   |  33 +
 mysql-test/main/timezone2.test                     |  31 +
 mysql-test/main/type_bit.result                    |   7 +
 mysql-test/main/type_bit.test                      |   9 +
 mysql-test/main/type_float.result                  | 101 ++-
 mysql-test/main/type_float.test                    |  69 ++-
 mysql-test/main/view_grant.result                  |   4 +
 mysql-test/main/view_grant.test                    |   5 +
 mysql-test/main/win.result                         |  89 +++
 mysql-test/main/win.test                           |  60 ++
 mysql-test/mysql-stress-test.pl                    |   2 +-
 mysql-test/mysql-test-run.pl                       |   6 +-
 mysql-test/purify.supp                             |   2 +-
 mysql-test/std_data/checkDBI_DBD-mysql.pl          |   2 +-
 mysql-test/std_data/ldml/latin1.xml                |   2 +-
 mysql-test/std_data/serversan-cert.pem             | 110 ++--
 mysql-test/std_data/serversan-key.pem              |  52 +-
 mysql-test/suite.pm                                |   4 +
 mysql-test/suite/binlog/r/binlog_mdev717.result    |   2 +
 mysql-test/suite/binlog/r/binlog_sql_mode.result   |   2 +
 mysql-test/suite/compat/oracle/r/events.result     |   2 +
 .../compat/oracle/r/table_value_constr.result      | 321 ++++++++++
 .../suite/compat/oracle/t/table_value_constr.test  | 151 +++++
 .../suite/engines/iuds/r/insert_decimal.result     |   4 +-
 .../suite/funcs_1/r/is_routines_embedded.result    |  12 +
 mysql-test/suite/galera/r/galera_events.result     |   2 +
 .../r/galera_parallel_autoinc_largetrx.result      |   1 +
 .../r/galera_parallel_autoinc_manytrx.result       |  33 +-
 .../galera/t/galera_parallel_autoinc_largetrx.test |   4 +-
 .../galera/t/galera_parallel_autoinc_manytrx.test  |  87 ++-
 .../suite/gcol/r/innodb_virtual_purge.result       |  17 +
 mysql-test/suite/gcol/t/innodb_virtual_purge.test  |  35 ++
 mysql-test/suite/innodb/r/foreign-keys.result      |  24 +
 mysql-test/suite/innodb/r/innodb-index.result      |  27 +
 mysql-test/suite/innodb/r/innodb-truncate.result   |  13 +
 .../innodb/r/innodb_skip_innodb_is_tables.result   |  16 +-
 .../suite/innodb/r/instant_alter_crash.result      |   5 +-
 mysql-test/suite/innodb/r/xa_debug.result          |   1 +
 mysql-test/suite/innodb/t/foreign-keys.test        |  31 +
 mysql-test/suite/innodb/t/innodb-index.test        |  20 +
 mysql-test/suite/innodb/t/innodb-truncate.test     |  19 +
 mysql-test/suite/innodb/t/instant_alter_crash.test |   5 +-
 mysql-test/suite/innodb/t/xa_debug.test            |   1 +
 .../suite/innodb_fts/r/innodb_ft_aux_table.result  | 121 ++++
 .../suite/innodb_fts/t/innodb_ft_aux_table.opt     |   6 +
 .../suite/innodb_fts/t/innodb_ft_aux_table.test    |  43 ++
 mysql-test/suite/json/r/json_no_table.result       |   4 +-
 .../suite/perfschema/r/pfs_upgrade_event.result    |   2 +
 .../suite/perfschema/t/ddl_esms_by_digest.test     |   2 +-
 .../suite/perfschema/t/dml_esms_by_digest.test     |   2 +-
 mysql-test/suite/perfschema_stress/README          |   2 +-
 .../suite/plugins/r/feedback_plugin_load.result    |   6 +-
 .../suite/plugins/r/feedback_plugin_send.result    |   6 +-
 mysql-test/suite/plugins/r/pam.result              |  20 +
 .../suite/plugins/t/feedback_plugin_load.test      |   2 +-
 mysql-test/suite/plugins/t/pam.test                |  25 +-
 mysql-test/suite/rpl/disabled.def                  |   1 -
 mysql-test/suite/rpl/extension/checksum.pl         |   2 +-
 mysql-test/suite/rpl/r/kill_race_condition.result  |  18 +
 mysql-test/suite/rpl/r/rpl_binlog_dup_entry.result |  29 +
 .../suite/rpl/r/rpl_create_drop_event.result       |   4 +
 mysql-test/suite/rpl/r/rpl_current_user.result     |   2 +
 mysql-test/suite/rpl/r/rpl_events.result           |   6 +
 mysql-test/suite/rpl/r/rpl_heartbeat_basic.result  |   2 +
 mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result |   2 +
 mysql-test/suite/rpl/r/rpl_invoked_features.result |   4 +
 mysql-test/suite/rpl/r/rpl_killed_ddl.result       |   2 +
 .../rpl/r/rpl_mixed_implicit_commit_binlog.result  |   2 +
 .../rpl/r/rpl_row_implicit_commit_binlog.result    |   2 +
 mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result  |   8 +-
 .../rpl/r/rpl_stm_implicit_commit_binlog.result    |   2 +
 .../suite/rpl/r/rpl_tmp_table_and_DDL.result       |   4 +
 mysql-test/suite/rpl/t/kill_race_condition.test    |  28 +
 mysql-test/suite/rpl/t/rpl_binlog_dup_entry.test   |  72 +++
 mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test    |   3 +-
 .../r/innodb_ft_result_cache_limit,32bit.rdiff     |  11 +
 ....result => innodb_ft_result_cache_limit.result} |   0
 .../r/innodb_ft_result_cache_limit_32.result       |   7 -
 .../r/sysvars_innodb,32bit,xtradb.rdiff-disabled   |   4 +-
 .../r/sysvars_innodb,xtradb.rdiff-disabled         |   4 +-
 ...t_32.test => innodb_ft_result_cache_limit.test} |   2 +-
 .../t/innodb_ft_result_cache_limit_64.test         |   9 -
 .../suite/sys_vars/t/max_digest_length_basic.test  |   2 +-
 .../suite/sys_vars/t/pfs_digests_size_basic.test   |   2 +-
 .../sys_vars/t/pfs_max_digest_length_basic.test    |   2 +-
 .../t/pfs_session_connect_attrs_size_basic.test    |   2 +-
 .../t/transaction_prealloc_size_bug27322.test      |   9 +-
 mysql-test/suite/versioning/common.inc             |   4 +
 mysql-test/suite/versioning/engines.combinations   |   3 +
 mysql-test/suite/versioning/r/create.result        |  19 +-
 mysql-test/suite/versioning/r/rpl.result           |   6 +-
 mysql-test/suite/versioning/r/update-big.result    |  25 +
 mysql-test/suite/versioning/t/create.test          |  18 +-
 mysql-test/suite/versioning/t/rpl.test             |   6 +-
 mysql-test/suite/versioning/t/update-big.test      |  34 ++
 mysql-test/valgrind.supp                           |   2 +-
 mysys/CMakeLists.txt                               |   2 +-
 mysys/array.c                                      |   2 +-
 mysys/base64.c                                     |   2 +-
 mysys/charset-def.c                                |   2 +-
 mysys/charset.c                                    |   2 +-
 mysys/checksum.c                                   |   2 +-
 mysys/errors.c                                     |   2 +-
 mysys/file_logger.c                                |   2 +-
 mysys/get_password.c                               |   2 +-
 mysys/hash.c                                       |   2 +-
 mysys/lf_alloc-pin.c                               |   2 +-
 mysys/lf_dynarray.c                                |   2 +-
 mysys/lf_hash.c                                    |   2 +-
 mysys/list.c                                       |   2 +-
 mysys/mf_arr_appstr.c                              |   2 +-
 mysys/mf_cache.c                                   |   2 +-
 mysys/mf_dirname.c                                 |   2 +-
 mysys/mf_fn_ext.c                                  |   2 +-
 mysys/mf_format.c                                  |   2 +-
 mysys/mf_getdate.c                                 |   2 +-
 mysys/mf_iocache.c                                 |   2 +-
 mysys/mf_iocache2.c                                |   2 +-
 mysys/mf_keycache.c                                |   2 +-
 mysys/mf_keycaches.c                               |   2 +-
 mysys/mf_loadpath.c                                |   2 +-
 mysys/mf_pack.c                                    |   2 +-
 mysys/mf_path.c                                    |   2 +-
 mysys/mf_qsort.c                                   |   2 +-
 mysys/mf_qsort2.c                                  |   2 +-
 mysys/mf_radix.c                                   |   2 +-
 mysys/mf_same.c                                    |   2 +-
 mysys/mf_sort.c                                    |   2 +-
 mysys/mf_soundex.c                                 |   2 +-
 mysys/mf_tempdir.c                                 |   2 +-
 mysys/mf_tempfile.c                                |   2 +-
 mysys/mf_unixpath.c                                |   2 +-
 mysys/mf_wcomp.c                                   |   2 +-
 mysys/mulalloc.c                                   |   2 +-
 mysys/my_access.c                                  |   2 +-
 mysys/my_addr_resolve.c                            |   2 +-
 mysys/my_alarm.c                                   |   2 +-
 mysys/my_alloc.c                                   |   2 +-
 mysys/my_basename.c                                |   2 +-
 mysys/my_bit.c                                     |   2 +-
 mysys/my_bitmap.c                                  |   2 +-
 mysys/my_chmod.c                                   |   2 +-
 mysys/my_chsize.c                                  |   2 +-
 mysys/my_compare.c                                 |   2 +-
 mysys/my_compress.c                                |   2 +-
 mysys/my_conio.c                                   |   2 +-
 mysys/my_copy.c                                    |   2 +-
 mysys/my_create.c                                  |   2 +-
 mysys/my_default.c                                 |   2 +-
 mysys/my_delete.c                                  |   2 +-
 mysys/my_div.c                                     |   2 +-
 mysys/my_dlerror.c                                 |   2 +-
 mysys/my_error.c                                   |   2 +-
 mysys/my_file.c                                    |   2 +-
 mysys/my_fopen.c                                   |   4 +-
 mysys/my_fstream.c                                 |   2 +-
 mysys/my_gethwaddr.c                               |   2 +-
 mysys/my_getncpus.c                                |   2 +-
 mysys/my_getopt.c                                  |   2 +-
 mysys/my_getpagesize.c                             |   2 +-
 mysys/my_getsystime.c                              |   2 +-
 mysys/my_getwd.c                                   |   2 +-
 mysys/my_init.c                                    |   2 +-
 mysys/my_largepage.c                               |   2 +-
 mysys/my_lib.c                                     |   2 +-
 mysys/my_libwrap.c                                 |   2 +-
 mysys/my_lock.c                                    |   2 +-
 mysys/my_lockmem.c                                 |   2 +-
 mysys/my_malloc.c                                  |   2 +-
 mysys/my_memmem.c                                  |   2 +-
 mysys/my_mess.c                                    |   2 +-
 mysys/my_mkdir.c                                   |   2 +-
 mysys/my_mmap.c                                    |   2 +-
 mysys/my_new.cc                                    |   2 +-
 mysys/my_once.c                                    |   2 +-
 mysys/my_open.c                                    |  11 +-
 mysys/my_port.c                                    |   2 +-
 mysys/my_pread.c                                   |   2 +-
 mysys/my_pthread.c                                 |   2 +-
 mysys/my_quick.c                                   |   2 +-
 mysys/my_rdtsc.c                                   |   2 +-
 mysys/my_read.c                                    |   2 +-
 mysys/my_redel.c                                   |   2 +-
 mysys/my_rename.c                                  |   2 +-
 mysys/my_rnd.c                                     |   2 +-
 mysys/my_safehash.c                                |   2 +-
 mysys/my_safehash.h                                |   2 +-
 mysys/my_seek.c                                    |   2 +-
 mysys/my_sleep.c                                   |   2 +-
 mysys/my_static.c                                  |   5 +-
 mysys/my_static.h                                  |   2 +-
 mysys/my_symlink.c                                 |   2 +-
 mysys/my_symlink2.c                                |   2 +-
 mysys/my_sync.c                                    |   2 +-
 mysys/my_thr_init.c                                |   2 +-
 mysys/my_timer_cycles.il                           |   2 +-
 mysys/my_uuid.c                                    |   2 +-
 mysys/my_wincond.c                                 |   2 +-
 mysys/my_windac.c                                  |   2 +-
 mysys/my_winerr.c                                  |   2 +-
 mysys/my_winfile.c                                 |   2 +-
 mysys/my_winthread.c                               |   2 +-
 mysys/my_write.c                                   |   2 +-
 mysys/mysys_priv.h                                 |   2 +-
 mysys/psi_noop.c                                   |   2 +-
 mysys/ptr_cmp.c                                    |   2 +-
 mysys/safemalloc.c                                 |   2 +-
 mysys/stacktrace.c                                 |   2 +-
 mysys/string.c                                     |   2 +-
 mysys/test_charset.c                               |   2 +-
 mysys/test_dir.c                                   |   2 +-
 mysys/test_thr_mutex.c                             |   2 +-
 mysys/test_xml.c                                   |   2 +-
 mysys/testhash.c                                   |   2 +-
 mysys/thr_alarm.c                                  |   2 +-
 mysys/thr_lock.c                                   |   2 +-
 mysys/thr_mutex.c                                  |   2 +-
 mysys/thr_rwlock.c                                 |   2 +-
 mysys/thr_timer.c                                  |   2 +-
 mysys/tree.c                                       |  50 +-
 mysys/typelib.c                                    |   2 +-
 mysys/waiting_threads.c                            |   2 +-
 mysys/wqueue.c                                     |   2 +-
 mysys_ssl/CMakeLists.txt                           |   2 +-
 mysys_ssl/my_crypt.cc                              |   2 +-
 mysys_ssl/my_md5.cc                                |   2 +-
 mysys_ssl/my_sha.ic                                |   2 +-
 mysys_ssl/my_sha1.cc                               |   2 +-
 mysys_ssl/my_sha224.cc                             |   2 +-
 mysys_ssl/my_sha256.cc                             |   2 +-
 mysys_ssl/my_sha384.cc                             |   2 +-
 mysys_ssl/my_sha512.cc                             |   2 +-
 mysys_ssl/yassl.cc                                 |   2 +-
 pcre/AUTHORS                                       |   6 +-
 pcre/ChangeLog                                     |  43 ++
 pcre/LICENCE                                       |  10 +-
 pcre/NEWS                                          |  10 +
 pcre/configure.ac                                  |  10 +-
 pcre/pcre_compile.c                                |  18 +-
 pcre/pcre_jit_compile.c                            |   2 +-
 pcre/pcrecpp.cc                                    |  64 +-
 pcre/pcrecpp_unittest.cc                           |  34 +-
 pcre/pcregrep.c                                    |   4 +-
 pcre/testdata/testinput1                           |  15 +
 pcre/testdata/testinput2                           |   3 +
 pcre/testdata/testinput4                           |   3 +
 pcre/testdata/testoutput1                          |  24 +
 pcre/testdata/testoutput2                          |   4 +
 pcre/testdata/testoutput4                          |   4 +
 plugin/audit_null/CMakeLists.txt                   |   2 +-
 plugin/audit_null/audit_null.c                     |   2 +-
 plugin/auth_dialog/CMakeLists.txt                  |   2 +-
 plugin/auth_dialog/dialog.c                        |   2 +-
 plugin/auth_ed25519/client_ed25519.c               |   2 +-
 plugin/auth_ed25519/common.h                       |   2 +-
 plugin/auth_ed25519/ed25519-t.c                    |   2 +-
 plugin/auth_ed25519/server_ed25519.c               |   2 +-
 plugin/auth_examples/CMakeLists.txt                |   2 +-
 plugin/auth_examples/auth_0x0100.c                 |   2 +-
 plugin/auth_examples/clear_password_client.c       |   2 +-
 plugin/auth_examples/dialog_examples.c             |   2 +-
 plugin/auth_examples/qa_auth_client.c              |   2 +-
 plugin/auth_examples/qa_auth_interface.c           |   2 +-
 plugin/auth_examples/qa_auth_server.c              |   2 +-
 plugin/auth_examples/test_plugin.c                 |   2 +-
 plugin/auth_pam/auth_pam.c                         |   6 +-
 plugin/auth_pam/auth_pam_base.c                    |   5 +-
 plugin/auth_pam/auth_pam_common.c                  |   5 +
 plugin/auth_pam/auth_pam_tool.c                    |   3 +-
 plugin/auth_pipe/auth_pipe.c                       |   2 +-
 plugin/auth_socket/CMakeLists.txt                  |   2 +-
 plugin/auth_socket/auth_socket.c                   |   2 +-
 .../aws_key_management_plugin.cc                   |   2 +-
 .../cracklib_password_check.c                      |   2 +-
 plugin/daemon_example/CMakeLists.txt               |   2 +-
 plugin/daemon_example/daemon_example.cc            |   2 +-
 .../debug_key_management_plugin.cc                 |   2 +-
 plugin/disks/information_schema_disks.cc           |   2 +-
 .../example_key_management_plugin.cc               |   2 +-
 plugin/feedback/feedback.cc                        |   2 +-
 plugin/feedback/feedback.h                         |   2 +-
 plugin/feedback/sender_thread.cc                   |   2 +-
 plugin/feedback/url_base.cc                        |   2 +-
 plugin/feedback/url_http.cc                        |   2 +-
 plugin/feedback/utils.cc                           |   2 +-
 .../file_key_management_plugin.cc                  |   2 +-
 plugin/file_key_management/parser.cc               |   2 +-
 plugin/file_key_management/parser.h                |   2 +-
 plugin/fulltext/CMakeLists.txt                     |   2 +-
 plugin/fulltext/plugin_example.c                   |   2 +-
 plugin/metadata_lock_info/metadata_lock_info.cc    |   2 +-
 plugin/query_response_time/plugin.cc               |   2 +-
 plugin/server_audit/CMakeLists.txt                 |   2 +-
 plugin/server_audit/COPYING                        |   4 +-
 plugin/server_audit/plugin_audit_v4.h              |   2 +-
 plugin/server_audit/server_audit.c                 |   2 +-
 .../simple_password_check/simple_password_check.c  |   2 +-
 plugin/sql_errlog/CMakeLists.txt                   |   2 +-
 plugin/sql_errlog/sql_errlog.c                     |   2 +-
 plugin/user_variables/user_variables.cc            |   2 +-
 plugin/versioning/CMakeLists.txt                   |   2 +-
 plugin/win_auth_client/CMakeLists.txt              |   2 +-
 plugin/win_auth_client/common.cc                   |   2 +-
 plugin/win_auth_client/common.h                    |   2 +-
 plugin/win_auth_client/handshake.cc                |   2 +-
 plugin/win_auth_client/handshake.h                 |   2 +-
 plugin/win_auth_client/handshake_client.cc         |   2 +-
 plugin/win_auth_client/log_client.cc               |   2 +-
 plugin/win_auth_client/plugin_client.cc            |   2 +-
 plugin/wsrep_info/plugin.cc                        |   2 +-
 scripts/CMakeLists.txt                             |   2 +-
 scripts/comp_sql.c                                 |   2 +-
 scripts/fill_help_tables.sql                       |   2 +-
 scripts/galera_recovery.sh                         |   2 +-
 scripts/maria_add_gis_sp.sql.in                    |   6 +-
 scripts/mariadb-service-convert                    |   2 +-
 scripts/msql2mysql.sh                              |   2 +-
 scripts/mysql_config.pl.in                         |   2 +-
 scripts/mysql_config.sh                            |   2 +-
 scripts/mysql_convert_table_format.sh              |   2 +-
 scripts/mysql_find_rows.sh                         |   2 +-
 scripts/mysql_fix_extensions.sh                    |   2 +-
 scripts/mysql_install_db.sh                        |   5 +-
 scripts/mysql_secure_installation.sh               |   2 +-
 scripts/mysql_setpermission.sh                     |   2 +-
 scripts/mysql_system_tables.sql                    |   2 +-
 scripts/mysql_system_tables_data.sql               |   2 +-
 scripts/mysql_system_tables_fix.sql                |   2 +-
 scripts/mysql_test_data_timezone.sql               |   2 +-
 scripts/mysqlaccess.sh                             |   2 +-
 scripts/mysqld_multi.sh                            |   2 +-
 scripts/mysqldumpslow.sh                           |   2 +-
 scripts/mysqlhotcopy.sh                            |   2 +-
 scripts/wsrep_sst_common.sh                        |   2 +-
 scripts/wsrep_sst_mariabackup.sh                   |   2 +-
 scripts/wsrep_sst_mysqldump.sh                     |   2 +-
 scripts/wsrep_sst_rsync.sh                         |   2 +-
 sql-bench/CMakeLists.txt                           |   2 +-
 sql-bench/as3ap.sh                                 |   2 +-
 sql-bench/bench-count-distinct.sh                  |   2 +-
 sql-bench/bench-init.pl.sh                         |   2 +-
 sql-bench/compare-results.sh                       |   2 +-
 sql-bench/copy-db.sh                               |   2 +-
 sql-bench/crash-me.sh                              |   2 +-
 sql-bench/run-all-tests.sh                         |   2 +-
 sql-bench/server-cfg.sh                            |   2 +-
 sql-bench/test-ATIS.sh                             |   2 +-
 sql-bench/test-alter-table.sh                      |   2 +-
 sql-bench/test-big-tables.sh                       |   2 +-
 sql-bench/test-connect.sh                          |   2 +-
 sql-bench/test-create.sh                           |   2 +-
 sql-bench/test-insert.sh                           |   2 +-
 sql-bench/test-select.sh                           |   2 +-
 sql-bench/test-transactions.sh                     |   2 +-
 sql-bench/test-wisconsin.sh                        |   2 +-
 sql-common/client.c                                |   8 +-
 sql-common/client_plugin.c                         |   2 +-
 sql-common/conf_to_src.c                           |   2 +-
 sql-common/errmsg.c                                |   2 +-
 sql-common/my_time.c                               |   2 +-
 sql-common/my_user.c                               |   2 +-
 sql-common/pack.c                                  |   2 +-
 sql/CMakeLists.txt                                 |   2 +-
 sql/authors.h                                      |   2 +-
 sql/bounded_queue.h                                |   2 +-
 sql/client_settings.h                              |   2 +-
 sql/compat56.cc                                    |   2 +-
 sql/compat56.h                                     |   2 +-
 sql/contributors.h                                 |   2 +-
 sql/create_options.cc                              |   2 +-
 sql/create_options.h                               |   2 +-
 sql/custom_conf.h                                  |   2 +-
 sql/datadict.cc                                    |   2 +-
 sql/datadict.h                                     |   2 +-
 sql/debug_sync.cc                                  |   2 +-
 sql/debug_sync.h                                   |   2 +-
 sql/derror.cc                                      |   2 +-
 sql/derror.h                                       |   2 +-
 sql/des_key_file.cc                                |   2 +-
 sql/des_key_file.h                                 |   2 +-
 sql/discover.cc                                    |   2 +-
 sql/discover.h                                     |   2 +-
 sql/encryption.cc                                  |   2 +-
 sql/event_data_objects.cc                          |   2 +-
 sql/event_data_objects.h                           |   2 +-
 sql/event_db_repository.cc                         |   2 +-
 sql/event_db_repository.h                          |   2 +-
 sql/event_parse_data.cc                            |   2 +-
 sql/event_parse_data.h                             |   2 +-
 sql/event_queue.cc                                 |   2 +-
 sql/event_queue.h                                  |   2 +-
 sql/event_scheduler.cc                             |   2 +-
 sql/event_scheduler.h                              |   2 +-
 sql/events.cc                                      |   8 +-
 sql/events.h                                       |   2 +-
 sql/field.cc                                       |  25 +-
 sql/field.h                                        |   2 +-
 sql/field_conv.cc                                  |   2 +-
 sql/filesort.cc                                    |   2 +-
 sql/filesort.h                                     |   2 +-
 sql/filesort_utils.cc                              |   2 +-
 sql/filesort_utils.h                               |   2 +-
 sql/gcalc_slicescan.cc                             |   2 +-
 sql/gcalc_slicescan.h                              |   2 +-
 sql/gcalc_tools.cc                                 |   2 +-
 sql/gcalc_tools.h                                  |   2 +-
 sql/gen_lex_hash.cc                                |   2 +-
 sql/gen_lex_token.cc                               |   2 +-
 sql/gen_win_tzname_data.ps1                        |  11 +
 sql/group_by_handler.cc                            |   2 +-
 sql/group_by_handler.h                             |   2 +-
 sql/gstream.cc                                     |   2 +-
 sql/gstream.h                                      |   2 +-
 sql/ha_partition.cc                                |  43 +-
 sql/ha_partition.h                                 |  14 +-
 sql/handler.cc                                     | 238 +++++---
 sql/handler.h                                      |  20 +-
 sql/hash_filo.cc                                   |   2 +-
 sql/hash_filo.h                                    |   2 +-
 sql/hostname.cc                                    |   2 +-
 sql/hostname.h                                     |   2 +-
 sql/init.cc                                        |   2 +-
 sql/init.h                                         |   2 +-
 sql/innodb_priv.h                                  |   2 +-
 sql/item.cc                                        |  13 +-
 sql/item.h                                         |  35 +-
 sql/item_buff.cc                                   |   2 +-
 sql/item_cmpfunc.cc                                |   2 +-
 sql/item_cmpfunc.h                                 |   2 +-
 sql/item_create.cc                                 |  41 +-
 sql/item_create.h                                  |   2 +-
 sql/item_func.cc                                   |  22 +-
 sql/item_func.h                                    |  56 +-
 sql/item_geofunc.cc                                |   2 +-
 sql/item_geofunc.h                                 |   2 +-
 sql/item_inetfunc.cc                               |   2 +-
 sql/item_inetfunc.h                                |   2 +-
 sql/item_jsonfunc.cc                               | 325 ++++++++++
 sql/item_jsonfunc.h                                |  12 +-
 sql/item_row.cc                                    |   2 +-
 sql/item_row.h                                     |   2 +-
 sql/item_strfunc.cc                                |   2 +-
 sql/item_strfunc.h                                 |   2 +-
 sql/item_subselect.cc                              |  17 +-
 sql/item_subselect.h                               |   4 +-
 sql/item_sum.cc                                    |  95 ++-
 sql/item_sum.h                                     |  10 +-
 sql/item_timefunc.cc                               |   2 +-
 sql/item_timefunc.h                                |   2 +-
 sql/item_xmlfunc.cc                                |   2 +-
 sql/item_xmlfunc.h                                 |   2 +-
 sql/key.cc                                         |   2 +-
 sql/key.h                                          |   2 +-
 sql/keycaches.cc                                   |   2 +-
 sql/keycaches.h                                    |   2 +-
 sql/lex.h                                          |   2 +-
 sql/lex_symbol.h                                   |   2 +-
 sql/lock.cc                                        |   2 +-
 sql/lock.h                                         |   2 +-
 sql/log.cc                                         |  14 +-
 sql/log.h                                          |   3 +-
 sql/log_event.cc                                   |  25 +-
 sql/log_event.h                                    |   2 +-
 sql/log_event_old.cc                               |  21 +-
 sql/log_event_old.h                                |   2 +-
 sql/log_slow.h                                     |   2 +-
 sql/main.cc                                        |   2 +-
 sql/mdl.cc                                         |   2 +-
 sql/mdl.h                                          |   2 +-
 sql/mem_root_array.h                               |   2 +-
 sql/mf_iocache.cc                                  |   2 +-
 sql/mf_iocache_encr.cc                             |   2 +-
 sql/multi_range_read.cc                            |   2 +-
 sql/multi_range_read.h                             |   2 +-
 sql/my_apc.cc                                      |   2 +-
 sql/my_apc.h                                       |   2 +-
 sql/my_decimal.cc                                  |   2 +-
 sql/my_decimal.h                                   |   2 +-
 sql/my_json_writer.cc                              |   2 +-
 sql/my_json_writer.h                               |   2 +-
 sql/mysql_install_db.cc                            |   2 +-
 sql/mysql_upgrade_service.cc                       |   5 +-
 sql/mysqld.cc                                      |  56 +-
 sql/mysqld.h                                       |  24 +-
 sql/mysqld_suffix.h                                |   2 +-
 sql/net_serv.cc                                    |   2 +-
 sql/opt_index_cond_pushdown.cc                     |   2 +-
 sql/opt_range.cc                                   |   4 +-
 sql/opt_range.h                                    |   2 +-
 sql/opt_range_mrr.cc                               |   2 +-
 sql/opt_subselect.cc                               |   2 +-
 sql/opt_subselect.h                                |   2 +-
 sql/opt_sum.cc                                     |   2 +-
 sql/opt_table_elimination.cc                       |   2 +-
 sql/parse_file.cc                                  |   2 +-
 sql/parse_file.h                                   |   2 +-
 sql/partition_element.h                            |   2 +-
 sql/partition_info.cc                              |   2 +-
 sql/partition_info.h                               |   2 +-
 sql/password.c                                     |   2 +-
 sql/plistsort.c                                    |   2 +-
 sql/procedure.cc                                   |   2 +-
 sql/procedure.h                                    |   2 +-
 sql/protocol.cc                                    |   4 +-
 sql/protocol.h                                     |   2 +-
 sql/records.cc                                     |   2 +-
 sql/records.h                                      |   2 +-
 sql/repl_failsafe.cc                               |   2 +-
 sql/repl_failsafe.h                                |   2 +-
 sql/replication.h                                  |   2 +-
 sql/rpl_constants.h                                |   2 +-
 sql/rpl_filter.cc                                  |   2 +-
 sql/rpl_filter.h                                   |   2 +-
 sql/rpl_gtid.cc                                    |   2 +-
 sql/rpl_gtid.h                                     |   2 +-
 sql/rpl_injector.cc                                |   2 +-
 sql/rpl_injector.h                                 |   2 +-
 sql/rpl_mi.cc                                      |   2 +-
 sql/rpl_mi.h                                       |   2 +-
 sql/rpl_record.cc                                  |   2 +-
 sql/rpl_record.h                                   |   2 +-
 sql/rpl_record_old.cc                              |   2 +-
 sql/rpl_record_old.h                               |   2 +-
 sql/rpl_reporting.cc                               |   2 +-
 sql/rpl_reporting.h                                |   2 +-
 sql/rpl_rli.cc                                     |   2 +-
 sql/rpl_rli.h                                      |   2 +-
 sql/rpl_tblmap.cc                                  |   2 +-
 sql/rpl_tblmap.h                                   |   2 +-
 sql/rpl_utility.cc                                 |   2 +-
 sql/rpl_utility.h                                  |   2 +-
 sql/scheduler.cc                                   |   2 +-
 sql/scheduler.h                                    |   2 +-
 sql/semisync.cc                                    |   2 +-
 sql/semisync.h                                     |   2 +-
 sql/semisync_master.h                              |   2 +-
 sql/session_tracker.cc                             |   1 +
 sql/set_var.cc                                     |   2 +-
 sql/set_var.h                                      |   2 +-
 sql/share/CMakeLists.txt                           |   2 +-
 sql/share/charsets/Index.xml                       |   2 +-
 sql/share/charsets/armscii8.xml                    |   2 +-
 sql/share/charsets/ascii.xml                       |   2 +-
 sql/share/charsets/cp1250.xml                      |   2 +-
 sql/share/charsets/cp1251.xml                      |   2 +-
 sql/share/charsets/cp1256.xml                      |   2 +-
 sql/share/charsets/cp1257.xml                      |   2 +-
 sql/share/charsets/cp850.xml                       |   2 +-
 sql/share/charsets/cp852.xml                       |   2 +-
 sql/share/charsets/cp866.xml                       |   2 +-
 sql/share/charsets/dec8.xml                        |   2 +-
 sql/share/charsets/geostd8.xml                     |   2 +-
 sql/share/charsets/greek.xml                       |   2 +-
 sql/share/charsets/hebrew.xml                      |   2 +-
 sql/share/charsets/hp8.xml                         |   2 +-
 sql/share/charsets/keybcs2.xml                     |   2 +-
 sql/share/charsets/koi8r.xml                       |   2 +-
 sql/share/charsets/koi8u.xml                       |   2 +-
 sql/share/charsets/languages.html                  |   2 +-
 sql/share/charsets/latin1.xml                      |   2 +-
 sql/share/charsets/latin2.xml                      |   2 +-
 sql/share/charsets/latin5.xml                      |   2 +-
 sql/share/charsets/latin7.xml                      |   2 +-
 sql/share/charsets/macce.xml                       |   2 +-
 sql/share/charsets/macroman.xml                    |   2 +-
 sql/share/charsets/swe7.xml                        |   2 +-
 sql/share/errmsg-utf8.txt                          |   4 +-
 sql/signal_handler.cc                              |   2 +-
 sql/slave.cc                                       |   2 +-
 sql/slave.h                                        |   2 +-
 sql/sp.cc                                          |   2 +-
 sql/sp.h                                           |   2 +-
 sql/sp_cache.cc                                    |   2 +-
 sql/sp_cache.h                                     |   2 +-
 sql/sp_head.cc                                     |   4 +-
 sql/sp_head.h                                      |   2 +-
 sql/sp_pcontext.cc                                 |   2 +-
 sql/sp_pcontext.h                                  |   2 +-
 sql/sp_rcontext.cc                                 |   2 +-
 sql/sp_rcontext.h                                  |   2 +-
 sql/spatial.cc                                     |   2 +-
 sql/spatial.h                                      |   2 +-
 sql/sql_acl.cc                                     |  37 +-
 sql/sql_acl.h                                      |   2 +-
 sql/sql_admin.cc                                   |   2 +-
 sql/sql_admin.h                                    |   2 +-
 sql/sql_alter.cc                                   |   2 +-
 sql/sql_alter.h                                    |   2 +-
 sql/sql_analyse.cc                                 |   2 +-
 sql/sql_analyse.h                                  |   2 +-
 sql/sql_analyze_stmt.cc                            |   2 +-
 sql/sql_analyze_stmt.h                             |   2 +-
 sql/sql_array.h                                    |   2 +-
 sql/sql_audit.cc                                   |   2 +-
 sql/sql_audit.h                                    |   2 +-
 sql/sql_base.cc                                    | 112 ++--
 sql/sql_base.h                                     |  19 +-
 sql/sql_basic_types.h                              |   2 +-
 sql/sql_binlog.cc                                  |   2 +-
 sql/sql_binlog.h                                   |   2 +-
 sql/sql_bitmap.h                                   |   2 +-
 sql/sql_bootstrap.cc                               |   2 +-
 sql/sql_bootstrap.h                                |   2 +-
 sql/sql_builtin.cc.in                              |   2 +-
 sql/sql_cache.cc                                   |   2 +-
 sql/sql_cache.h                                    |   2 +-
 sql/sql_callback.h                                 |   2 +-
 sql/sql_class.cc                                   |   2 +-
 sql/sql_class.h                                    |   3 +-
 sql/sql_client.cc                                  |   2 +-
 sql/sql_cmd.h                                      |   2 +-
 sql/sql_connect.cc                                 |   2 +-
 sql/sql_connect.h                                  |   2 +-
 sql/sql_const.h                                    |   2 +-
 sql/sql_crypt.cc                                   |   2 +-
 sql/sql_crypt.h                                    |   2 +-
 sql/sql_cursor.cc                                  |   2 +-
 sql/sql_cursor.h                                   |   2 +-
 sql/sql_db.cc                                      |  24 +-
 sql/sql_db.h                                       |   4 +-
 sql/sql_delete.cc                                  |   9 +-
 sql/sql_delete.h                                   |   2 +-
 sql/sql_derived.cc                                 |   2 +-
 sql/sql_derived.h                                  |   2 +-
 sql/sql_digest.cc                                  |   2 +-
 sql/sql_digest.h                                   |   2 +-
 sql/sql_digest_stream.h                            |   2 +-
 sql/sql_do.cc                                      |   2 +-
 sql/sql_do.h                                       |   2 +-
 sql/sql_error.cc                                   |   2 +-
 sql/sql_error.h                                    |   2 +-
 sql/sql_explain.cc                                 |   2 +-
 sql/sql_explain.h                                  |   2 +-
 sql/sql_expression_cache.cc                        |   2 +-
 sql/sql_expression_cache.h                         |   2 +-
 sql/sql_get_diagnostics.cc                         |   2 +-
 sql/sql_get_diagnostics.h                          |   2 +-
 sql/sql_handler.cc                                 |   2 +-
 sql/sql_handler.h                                  |   2 +-
 sql/sql_help.cc                                    |   2 +-
 sql/sql_help.h                                     |   2 +-
 sql/sql_hset.h                                     |   2 +-
 sql/sql_insert.cc                                  |   2 +-
 sql/sql_insert.h                                   |   2 +-
 sql/sql_join_cache.cc                              |   2 +-
 sql/sql_join_cache.h                               |   2 +-
 sql/sql_lex.cc                                     |  32 +-
 sql/sql_lex.h                                      |  10 +-
 sql/sql_lifo_buffer.h                              |   2 +-
 sql/sql_list.cc                                    |   2 +-
 sql/sql_list.h                                     |   2 +-
 sql/sql_load.cc                                    |   2 +-
 sql/sql_load.h                                     |   2 +-
 sql/sql_locale.cc                                  |   2 +-
 sql/sql_locale.h                                   |   2 +-
 sql/sql_manager.cc                                 |   2 +-
 sql/sql_manager.h                                  |   2 +-
 sql/sql_parse.cc                                   |  18 +-
 sql/sql_parse.h                                    |   2 +-
 sql/sql_partition.cc                               |   2 +-
 sql/sql_partition.h                                |   2 +-
 sql/sql_partition_admin.cc                         |   2 +-
 sql/sql_partition_admin.h                          |   2 +-
 sql/sql_plist.h                                    |   2 +-
 sql/sql_plugin.cc                                  |   2 +-
 sql/sql_plugin.h                                   |   2 +-
 sql/sql_plugin_compat.h                            |   2 +-
 sql/sql_plugin_services.ic                         |   2 +-
 sql/sql_prepare.cc                                 |   2 +-
 sql/sql_prepare.h                                  |   2 +-
 sql/sql_priv.h                                     |   2 +-
 sql/sql_profile.cc                                 |   2 +-
 sql/sql_profile.h                                  |   2 +-
 sql/sql_reload.cc                                  |   9 +-
 sql/sql_reload.h                                   |   2 +-
 sql/sql_rename.cc                                  |   2 +-
 sql/sql_rename.h                                   |   2 +-
 sql/sql_repl.cc                                    |   2 +-
 sql/sql_repl.h                                     |   2 +-
 sql/sql_select.cc                                  |  44 +-
 sql/sql_select.h                                   |   2 +-
 sql/sql_servers.cc                                 |   2 +-
 sql/sql_servers.h                                  |   2 +-
 sql/sql_show.cc                                    |   5 +-
 sql/sql_show.h                                     |   2 +-
 sql/sql_signal.cc                                  |   2 +-
 sql/sql_signal.h                                   |   2 +-
 sql/sql_sort.h                                     |   2 +-
 sql/sql_state.c                                    |   2 +-
 sql/sql_statistics.cc                              |  27 +-
 sql/sql_statistics.h                               |   2 +-
 sql/sql_string.cc                                  |  23 +-
 sql/sql_string.h                                   |   2 +-
 sql/sql_table.cc                                   | 210 ++-----
 sql/sql_table.h                                    |   2 +-
 sql/sql_tablespace.cc                              |   2 +-
 sql/sql_tablespace.h                               |   2 +-
 sql/sql_test.cc                                    |  12 +-
 sql/sql_test.h                                     |   2 +-
 sql/sql_time.cc                                    |   2 +-
 sql/sql_time.h                                     |   2 +-
 sql/sql_trigger.cc                                 |   2 +-
 sql/sql_trigger.h                                  |   2 +-
 sql/sql_truncate.cc                                |  16 +-
 sql/sql_truncate.h                                 |   2 +-
 sql/sql_tvc.cc                                     | 232 ++++++-
 sql/sql_tvc.h                                      |   5 +
 sql/sql_type.cc                                    |  88 ++-
 sql/sql_type.h                                     |  28 +-
 sql/sql_type_int.h                                 |   2 +-
 sql/sql_type_real.h                                |  47 ++
 sql/sql_udf.cc                                     |   2 +-
 sql/sql_udf.h                                      |   2 +-
 sql/sql_union.cc                                   |  42 +-
 sql/sql_union.h                                    |   2 +-
 sql/sql_update.cc                                  |  38 +-
 sql/sql_update.h                                   |   2 +-
 sql/sql_view.cc                                    |   5 +-
 sql/sql_view.h                                     |   2 +-
 sql/sql_window.cc                                  |  27 +
 sql/sql_yacc.yy                                    |  35 +-
 sql/sql_yacc_ora.yy                                |  33 +-
 sql/strfunc.cc                                     |   2 +-
 sql/strfunc.h                                      |   2 +-
 sql/structs.h                                      |   2 +-
 sql/sys_vars.cc                                    |   2 +-
 sql/sys_vars.ic                                    |   2 +-
 sql/sys_vars_shared.h                              |   2 +-
 sql/table.cc                                       |   5 +-
 sql/table.h                                        |   3 +-
 sql/table_cache.cc                                 |   2 +-
 sql/table_cache.h                                  |   2 +-
 sql/thr_malloc.cc                                  |   2 +-
 sql/thr_malloc.h                                   |   2 +-
 sql/threadpool.h                                   |   2 +-
 sql/threadpool_common.cc                           |   2 +-
 sql/threadpool_generic.cc                          |   2 +-
 sql/threadpool_win.cc                              |   2 +-
 sql/transaction.cc                                 |   2 +-
 sql/transaction.h                                  |   2 +-
 sql/tzfile.h                                       |   2 +-
 sql/tztime.cc                                      |   2 +-
 sql/tztime.h                                       |   2 +-
 sql/udf_example.c                                  |   2 +-
 sql/uniques.cc                                     |   2 +-
 sql/unireg.cc                                      |   2 +-
 sql/unireg.h                                       |   2 +-
 sql/win_tzname_data.h                              | 136 +++++
 sql/winservice.c                                   |   2 +-
 sql/winservice.h                                   |   2 +-
 sql/wsrep_applier.cc                               |   2 +-
 sql/wsrep_applier.h                                |   2 +-
 sql/wsrep_binlog.cc                                |   2 +-
 sql/wsrep_binlog.h                                 |   2 +-
 sql/wsrep_check_opts.cc                            |   2 +-
 sql/wsrep_dummy.cc                                 |   2 +-
 sql/wsrep_mysqld.cc                                |   2 +-
 sql/wsrep_mysqld.h                                 |   2 +-
 sql/wsrep_mysqld_c.h                               |   2 +-
 sql/wsrep_notify.cc                                |   2 +-
 sql/wsrep_priv.h                                   |   2 +-
 sql/wsrep_sst.cc                                   |   2 +-
 sql/wsrep_sst.h                                    |   2 +-
 sql/wsrep_thd.cc                                   |   2 +-
 sql/wsrep_thd.h                                    |   2 +-
 sql/wsrep_utils.cc                                 |   2 +-
 sql/wsrep_utils.h                                  |   2 +-
 sql/wsrep_var.cc                                   |   2 +-
 sql/wsrep_var.h                                    |   2 +-
 sql/wsrep_xid.cc                                   |   2 +-
 sql/wsrep_xid.h                                    |   2 +-
 storage/archive/CMakeLists.txt                     |   2 +-
 storage/archive/archive_reader.c                   |   2 +-
 storage/archive/archive_test.c                     |   2 +-
 storage/archive/ha_archive.cc                      |   2 +-
 storage/archive/ha_archive.h                       |   2 +-
 storage/blackhole/CMakeLists.txt                   |   2 +-
 storage/blackhole/ha_blackhole.cc                  |   2 +-
 storage/blackhole/ha_blackhole.h                   |   2 +-
 storage/cassandra/ha_cassandra.cc                  |   2 +-
 storage/cassandra/ha_cassandra.h                   |   2 +-
 storage/connect/CMakeLists.txt                     |   2 +-
 storage/connect/connect.cc                         |   2 +-
 storage/connect/connect.h                          |   2 +-
 storage/connect/filter.h                           |   1 +
 storage/connect/ha_connect.cc                      |  87 ++-
 storage/connect/ha_connect.h                       |   5 +-
 storage/connect/inihandl.cpp                       |   2 +-
 storage/connect/jmgoconn.cpp                       |   4 +-
 storage/connect/mycat.cc                           |   2 +-
 storage/connect/mycat.h                            |   2 +-
 storage/connect/tabdos.cpp                         |  42 +-
 storage/connect/tabfmt.cpp                         |  13 +-
 storage/connect/user_connect.cc                    |   5 +-
 storage/connect/user_connect.h                     |   2 +-
 storage/connect/value.cpp                          |  97 ++-
 storage/connect/value.h                            |  16 +-
 storage/csv/CMakeLists.txt                         |   2 +-
 storage/csv/ha_tina.cc                             |   2 +-
 storage/csv/ha_tina.h                              |   2 +-
 storage/csv/transparent_file.cc                    |   2 +-
 storage/csv/transparent_file.h                     |   2 +-
 storage/example/CMakeLists.txt                     |   2 +-
 storage/example/ha_example.cc                      |   2 +-
 storage/example/ha_example.h                       |   2 +-
 storage/federated/CMakeLists.txt                   |   2 +-
 storage/federated/ha_federated.cc                  |   2 +-
 storage/federated/ha_federated.h                   |   2 +-
 storage/heap/CMakeLists.txt                        |   2 +-
 storage/heap/_check.c                              |   2 +-
 storage/heap/_rectest.c                            |   2 +-
 storage/heap/ha_heap.cc                            |   2 +-
 storage/heap/ha_heap.h                             |   2 +-
 storage/heap/heapdef.h                             |   2 +-
 storage/heap/hp_block.c                            |   2 +-
 storage/heap/hp_clear.c                            |   2 +-
 storage/heap/hp_close.c                            |   2 +-
 storage/heap/hp_create.c                           |   2 +-
 storage/heap/hp_delete.c                           |   2 +-
 storage/heap/hp_extra.c                            |   2 +-
 storage/heap/hp_hash.c                             |   2 +-
 storage/heap/hp_info.c                             |   2 +-
 storage/heap/hp_open.c                             |   2 +-
 storage/heap/hp_panic.c                            |   2 +-
 storage/heap/hp_rename.c                           |   2 +-
 storage/heap/hp_rfirst.c                           |   2 +-
 storage/heap/hp_rkey.c                             |   2 +-
 storage/heap/hp_rlast.c                            |   2 +-
 storage/heap/hp_rnext.c                            |   2 +-
 storage/heap/hp_rprev.c                            |   2 +-
 storage/heap/hp_rrnd.c                             |   2 +-
 storage/heap/hp_rsame.c                            |   2 +-
 storage/heap/hp_scan.c                             |   2 +-
 storage/heap/hp_static.c                           |   2 +-
 storage/heap/hp_test1.c                            |   2 +-
 storage/heap/hp_test2.c                            |   2 +-
 storage/heap/hp_update.c                           |   2 +-
 storage/heap/hp_write.c                            |   4 +-
 storage/innobase/CMakeLists.txt                    |   2 +-
 storage/innobase/btr/btr0btr.cc                    |   2 +-
 storage/innobase/btr/btr0bulk.cc                   |   2 +-
 storage/innobase/btr/btr0cur.cc                    |   2 +-
 storage/innobase/btr/btr0defragment.cc             |   2 +-
 storage/innobase/btr/btr0pcur.cc                   |   2 +-
 storage/innobase/btr/btr0sea.cc                    |   2 +-
 storage/innobase/buf/buf0buddy.cc                  |   2 +-
 storage/innobase/buf/buf0buf.cc                    |   2 +-
 storage/innobase/buf/buf0checksum.cc               |   2 +-
 storage/innobase/buf/buf0dblwr.cc                  |   9 +-
 storage/innobase/buf/buf0dump.cc                   |   2 +-
 storage/innobase/buf/buf0flu.cc                    |   2 +-
 storage/innobase/buf/buf0lru.cc                    |   2 +-
 storage/innobase/buf/buf0rea.cc                    |   2 +-
 storage/innobase/bzip2.cmake                       |   2 +-
 storage/innobase/compile-innodb                    |   2 +-
 storage/innobase/data/data0data.cc                 |   2 +-
 storage/innobase/data/data0type.cc                 |   2 +-
 storage/innobase/dict/dict0boot.cc                 |   2 +-
 storage/innobase/dict/dict0crea.cc                 |   4 +-
 storage/innobase/dict/dict0defrag_bg.cc            |   2 +-
 storage/innobase/dict/dict0dict.cc                 |   2 +-
 storage/innobase/dict/dict0load.cc                 |   2 +-
 storage/innobase/dict/dict0mem.cc                  |   2 +-
 storage/innobase/dict/dict0stats.cc                |   6 +-
 storage/innobase/dict/dict0stats_bg.cc             |   2 +-
 storage/innobase/eval/eval0eval.cc                 |   2 +-
 storage/innobase/eval/eval0proc.cc                 |   2 +-
 storage/innobase/fil/fil0crypt.cc                  |   2 +-
 storage/innobase/fil/fil0fil.cc                    |   5 +-
 storage/innobase/fil/fil0pagecompress.cc           |   2 +-
 storage/innobase/fsp/fsp0file.cc                   |   2 +-
 storage/innobase/fsp/fsp0fsp.cc                    |   2 +-
 storage/innobase/fsp/fsp0space.cc                  |   2 +-
 storage/innobase/fsp/fsp0sysspace.cc               |   2 +-
 storage/innobase/fts/fts0ast.cc                    |   2 +-
 storage/innobase/fts/fts0blex.cc                   |   2 +-
 storage/innobase/fts/fts0blex.l                    |   2 +-
 storage/innobase/fts/fts0config.cc                 |  11 +-
 storage/innobase/fts/fts0fts.cc                    |  68 +--
 storage/innobase/fts/fts0opt.cc                    | 249 +++-----
 storage/innobase/fts/fts0pars.y                    |   2 +-
 storage/innobase/fts/fts0plugin.cc                 |   2 +-
 storage/innobase/fts/fts0que.cc                    |   6 +-
 storage/innobase/fts/fts0sql.cc                    | 105 ++--
 storage/innobase/fts/fts0tlex.cc                   |   2 +-
 storage/innobase/fts/fts0tlex.l                    |   2 +-
 storage/innobase/fts/make_parser.sh                |   2 +-
 storage/innobase/fut/fut0lst.cc                    |   2 +-
 storage/innobase/gis/gis0geo.cc                    |   2 +-
 storage/innobase/gis/gis0rtree.cc                  |  11 +-
 storage/innobase/gis/gis0sea.cc                    |   2 +-
 storage/innobase/ha/ha0ha.cc                       |   2 +-
 storage/innobase/ha/ha0storage.cc                  |   2 +-
 storage/innobase/ha/hash0hash.cc                   |   2 +-
 storage/innobase/handler/ha_innodb.cc              | 115 ++--
 storage/innobase/handler/ha_innodb.h               |   2 +-
 storage/innobase/handler/handler0alter.cc          |  29 +-
 storage/innobase/handler/i_s.cc                    | 105 ++--
 storage/innobase/handler/i_s.h                     |   8 +-
 storage/innobase/ibuf/ibuf0ibuf.cc                 |   2 +-
 storage/innobase/include/btr0btr.h                 |   2 +-
 storage/innobase/include/btr0btr.ic                |   2 +-
 storage/innobase/include/btr0bulk.h                |   2 +-
 storage/innobase/include/btr0cur.h                 |   2 +-
 storage/innobase/include/btr0cur.ic                |   2 +-
 storage/innobase/include/btr0defragment.h          |   2 +-
 storage/innobase/include/btr0pcur.h                |   2 +-
 storage/innobase/include/btr0pcur.ic               |   2 +-
 storage/innobase/include/btr0sea.h                 |   2 +-
 storage/innobase/include/btr0sea.ic                |   2 +-
 storage/innobase/include/btr0types.h               |   2 +-
 storage/innobase/include/buf0buddy.h               |   2 +-
 storage/innobase/include/buf0buddy.ic              |   2 +-
 storage/innobase/include/buf0buf.h                 |   2 +-
 storage/innobase/include/buf0buf.ic                |   2 +-
 storage/innobase/include/buf0checksum.h            |   2 +-
 storage/innobase/include/buf0dblwr.h               |   2 +-
 storage/innobase/include/buf0dump.h                |   2 +-
 storage/innobase/include/buf0flu.h                 |   2 +-
 storage/innobase/include/buf0flu.ic                |   2 +-
 storage/innobase/include/buf0lru.h                 |   2 +-
 storage/innobase/include/buf0rea.h                 |   2 +-
 storage/innobase/include/buf0types.h               |   2 +-
 storage/innobase/include/data0data.h               |   2 +-
 storage/innobase/include/data0data.ic              |   2 +-
 storage/innobase/include/data0type.h               |   2 +-
 storage/innobase/include/data0type.ic              |   2 +-
 storage/innobase/include/data0types.h              |   2 +-
 storage/innobase/include/db0err.h                  |   2 +-
 storage/innobase/include/dict0boot.h               |   2 +-
 storage/innobase/include/dict0boot.ic              |   2 +-
 storage/innobase/include/dict0crea.h               |   2 +-
 storage/innobase/include/dict0crea.ic              |   2 +-
 storage/innobase/include/dict0defrag_bg.h          |   2 +-
 storage/innobase/include/dict0dict.h               |   2 +-
 storage/innobase/include/dict0dict.ic              |   2 +-
 storage/innobase/include/dict0load.h               |   2 +-
 storage/innobase/include/dict0mem.h                |   2 +-
 storage/innobase/include/dict0mem.ic               |   2 +-
 storage/innobase/include/dict0pagecompress.h       |   2 +-
 storage/innobase/include/dict0pagecompress.ic      |   2 +-
 storage/innobase/include/dict0priv.h               |   2 +-
 storage/innobase/include/dict0priv.ic              |   2 +-
 storage/innobase/include/dict0stats.h              |   2 +-
 storage/innobase/include/dict0stats.ic             |   2 +-
 storage/innobase/include/dict0stats_bg.h           |   2 +-
 storage/innobase/include/dict0types.h              |   2 +-
 storage/innobase/include/dyn0buf.h                 |   2 +-
 storage/innobase/include/dyn0types.h               |   2 +-
 storage/innobase/include/eval0eval.h               |   2 +-
 storage/innobase/include/eval0eval.ic              |   2 +-
 storage/innobase/include/eval0proc.h               |   2 +-
 storage/innobase/include/eval0proc.ic              |   2 +-
 storage/innobase/include/fil0crypt.h               |   2 +-
 storage/innobase/include/fil0crypt.ic              |   2 +-
 storage/innobase/include/fil0fil.h                 |   5 +-
 storage/innobase/include/fil0fil.ic                |   2 +-
 storage/innobase/include/fil0pagecompress.h        |   2 +-
 storage/innobase/include/fsp0file.h                |   2 +-
 storage/innobase/include/fsp0fsp.h                 |   2 +-
 storage/innobase/include/fsp0fsp.ic                |   2 +-
 storage/innobase/include/fsp0pagecompress.h        |   2 +-
 storage/innobase/include/fsp0pagecompress.ic       |   2 +-
 storage/innobase/include/fsp0space.h               |   2 +-
 storage/innobase/include/fsp0sysspace.h            |   2 +-
 storage/innobase/include/fsp0types.h               |   2 +-
 storage/innobase/include/fts0ast.h                 |   2 +-
 storage/innobase/include/fts0fts.h                 |  30 +-
 storage/innobase/include/fts0opt.h                 |   2 +-
 storage/innobase/include/fts0plugin.h              |   2 +-
 storage/innobase/include/fts0priv.h                | 134 ++--
 storage/innobase/include/fts0priv.ic               |   2 +-
 storage/innobase/include/fts0tokenize.h            |   2 +-
 storage/innobase/include/fts0types.h               |   2 +-
 storage/innobase/include/fts0types.ic              |   2 +-
 storage/innobase/include/fts0vlc.ic                |   2 +-
 storage/innobase/include/fut0fut.h                 |   2 +-
 storage/innobase/include/fut0lst.h                 |   2 +-
 storage/innobase/include/fut0lst.ic                |   2 +-
 storage/innobase/include/gis0geo.h                 |   2 +-
 storage/innobase/include/gis0rtree.h               |   2 +-
 storage/innobase/include/gis0rtree.ic              |   2 +-
 storage/innobase/include/gis0type.h                |   2 +-
 storage/innobase/include/ha0ha.h                   |   2 +-
 storage/innobase/include/ha0ha.ic                  |   2 +-
 storage/innobase/include/ha0storage.h              |   2 +-
 storage/innobase/include/ha0storage.ic             |   2 +-
 storage/innobase/include/ha_prototypes.h           |   2 +-
 storage/innobase/include/handler0alter.h           |  13 +-
 storage/innobase/include/hash0hash.h               |   2 +-
 storage/innobase/include/hash0hash.ic              |   2 +-
 storage/innobase/include/ib0mutex.h                |   2 +-
 storage/innobase/include/ibuf0ibuf.h               |   2 +-
 storage/innobase/include/ibuf0ibuf.ic              |   2 +-
 storage/innobase/include/ibuf0types.h              |   2 +-
 storage/innobase/include/lock0iter.h               |   2 +-
 storage/innobase/include/lock0lock.h               |   2 +-
 storage/innobase/include/lock0lock.ic              |   2 +-
 storage/innobase/include/lock0prdt.h               |   2 +-
 storage/innobase/include/lock0priv.h               |   2 +-
 storage/innobase/include/lock0priv.ic              |   2 +-
 storage/innobase/include/lock0types.h              |   2 +-
 storage/innobase/include/log0crypt.h               |   2 +-
 storage/innobase/include/log0log.h                 |   6 +-
 storage/innobase/include/log0log.ic                |   2 +-
 storage/innobase/include/log0recv.h                |   2 +-
 storage/innobase/include/log0types.h               |   2 +-
 storage/innobase/include/mach0data.h               |   2 +-
 storage/innobase/include/mach0data.ic              |   2 +-
 storage/innobase/include/mem0mem.h                 |   2 +-
 storage/innobase/include/mem0mem.ic                |   2 +-
 storage/innobase/include/mtr0log.h                 |   2 +-
 storage/innobase/include/mtr0log.ic                |   2 +-
 storage/innobase/include/mtr0mtr.h                 |   2 +-
 storage/innobase/include/mtr0mtr.ic                |   2 +-
 storage/innobase/include/mtr0types.h               |   2 +-
 storage/innobase/include/os0api.h                  |   2 +-
 storage/innobase/include/os0event.h                |   2 +-
 storage/innobase/include/os0file.h                 |   2 +-
 storage/innobase/include/os0file.ic                |   2 +-
 storage/innobase/include/os0once.h                 |   2 +-
 storage/innobase/include/os0proc.h                 |   2 +-
 storage/innobase/include/os0thread.h               |   2 +-
 storage/innobase/include/page0cur.h                |   2 +-
 storage/innobase/include/page0cur.ic               |   2 +-
 storage/innobase/include/page0page.h               |   2 +-
 storage/innobase/include/page0page.ic              |   2 +-
 storage/innobase/include/page0types.h              |   2 +-
 storage/innobase/include/page0zip.h                |   2 +-
 storage/innobase/include/page0zip.ic               |   2 +-
 storage/innobase/include/pars0opt.h                |   2 +-
 storage/innobase/include/pars0pars.h               |   2 +-
 storage/innobase/include/pars0sym.h                |   2 +-
 storage/innobase/include/pars0types.h              |   2 +-
 storage/innobase/include/que0que.h                 |   2 +-
 storage/innobase/include/que0que.ic                |   2 +-
 storage/innobase/include/que0types.h               |   2 +-
 storage/innobase/include/read0types.h              |   2 +-
 storage/innobase/include/rem0cmp.h                 |   2 +-
 storage/innobase/include/rem0cmp.ic                |   2 +-
 storage/innobase/include/rem0rec.h                 |   2 +-
 storage/innobase/include/rem0rec.ic                |   2 +-
 storage/innobase/include/rem0types.h               |   2 +-
 storage/innobase/include/row0ext.h                 |   2 +-
 storage/innobase/include/row0ext.ic                |   2 +-
 storage/innobase/include/row0ftsort.h              |   2 +-
 storage/innobase/include/row0import.h              |   2 +-
 storage/innobase/include/row0ins.h                 |   2 +-
 storage/innobase/include/row0log.h                 |   2 +-
 storage/innobase/include/row0log.ic                |   2 +-
 storage/innobase/include/row0merge.h               |   2 +-
 storage/innobase/include/row0mysql.h               |   2 +-
 storage/innobase/include/row0purge.h               |   2 +-
 storage/innobase/include/row0quiesce.h             |   2 +-
 storage/innobase/include/row0row.h                 |   2 +-
 storage/innobase/include/row0row.ic                |   2 +-
 storage/innobase/include/row0sel.h                 |   2 +-
 storage/innobase/include/row0sel.ic                |   2 +-
 storage/innobase/include/row0types.h               |   2 +-
 storage/innobase/include/row0uins.h                |   2 +-
 storage/innobase/include/row0umod.h                |   2 +-
 storage/innobase/include/row0undo.h                |   2 +-
 storage/innobase/include/row0upd.h                 |   2 +-
 storage/innobase/include/row0upd.ic                |   2 +-
 storage/innobase/include/row0vers.h                |   2 +-
 storage/innobase/include/srv0conc.h                |   2 +-
 storage/innobase/include/srv0mon.h                 |   2 +-
 storage/innobase/include/srv0mon.ic                |   2 +-
 storage/innobase/include/srv0srv.h                 |   2 +-
 storage/innobase/include/srv0start.h               |   2 +-
 storage/innobase/include/sync0arr.h                |   2 +-
 storage/innobase/include/sync0arr.ic               |   2 +-
 storage/innobase/include/sync0debug.h              |   2 +-
 storage/innobase/include/sync0policy.h             |   2 +-
 storage/innobase/include/sync0rw.h                 |   2 +-
 storage/innobase/include/sync0rw.ic                |   2 +-
 storage/innobase/include/sync0sync.h               |   2 +-
 storage/innobase/include/sync0types.h              |   2 +-
 storage/innobase/include/trx0i_s.h                 |   2 +-
 storage/innobase/include/trx0purge.h               |   2 +-
 storage/innobase/include/trx0purge.ic              |   2 +-
 storage/innobase/include/trx0rec.h                 |   2 +-
 storage/innobase/include/trx0rec.ic                |   2 +-
 storage/innobase/include/trx0roll.h                |   2 +-
 storage/innobase/include/trx0rseg.h                |   2 +-
 storage/innobase/include/trx0rseg.ic               |   2 +-
 storage/innobase/include/trx0sys.h                 |   2 +-
 storage/innobase/include/trx0trx.h                 |   2 +-
 storage/innobase/include/trx0trx.ic                |   2 +-
 storage/innobase/include/trx0types.h               |   2 +-
 storage/innobase/include/trx0undo.h                |   2 +-
 storage/innobase/include/trx0undo.ic               |   2 +-
 storage/innobase/include/trx0xa.h                  |   2 +-
 storage/innobase/include/univ.i                    |   2 +-
 storage/innobase/include/ut0byte.h                 |   2 +-
 storage/innobase/include/ut0byte.ic                |   2 +-
 storage/innobase/include/ut0counter.h              |   2 +-
 storage/innobase/include/ut0crc32.h                |   2 +-
 storage/innobase/include/ut0dbg.h                  |   2 +-
 storage/innobase/include/ut0list.h                 |   2 +-
 storage/innobase/include/ut0list.ic                |   2 +-
 storage/innobase/include/ut0lst.h                  |   2 +-
 storage/innobase/include/ut0mem.h                  |   2 +-
 storage/innobase/include/ut0mem.ic                 |   2 +-
 storage/innobase/include/ut0mutex.h                |   2 +-
 storage/innobase/include/ut0new.h                  |   2 +-
 storage/innobase/include/ut0pool.h                 |   2 +-
 storage/innobase/include/ut0rbt.h                  |   2 +-
 storage/innobase/include/ut0rnd.h                  |   2 +-
 storage/innobase/include/ut0rnd.ic                 |   2 +-
 storage/innobase/include/ut0sort.h                 |   2 +-
 storage/innobase/include/ut0stage.h                |   2 +-
 storage/innobase/include/ut0timer.h                |   2 +-
 storage/innobase/include/ut0timer.ic               |   2 +-
 storage/innobase/include/ut0ut.h                   |   2 +-
 storage/innobase/include/ut0ut.ic                  |   2 +-
 storage/innobase/include/ut0vec.h                  |   2 +-
 storage/innobase/include/ut0vec.ic                 |   2 +-
 storage/innobase/include/ut0wqueue.h               |   2 +-
 storage/innobase/lock/lock0iter.cc                 |   2 +-
 storage/innobase/lock/lock0lock.cc                 |   2 +-
 storage/innobase/lock/lock0prdt.cc                 |   2 +-
 storage/innobase/lock/lock0wait.cc                 |   2 +-
 storage/innobase/log/log0crypt.cc                  |   2 +-
 storage/innobase/log/log0log.cc                    | 117 +---
 storage/innobase/log/log0recv.cc                   |   2 +-
 storage/innobase/lz4.cmake                         |   2 +-
 storage/innobase/lzma.cmake                        |   2 +-
 storage/innobase/lzo.cmake                         |   2 +-
 storage/innobase/mach/mach0data.cc                 |   2 +-
 storage/innobase/mem/mem0mem.cc                    |   2 +-
 storage/innobase/mtr/mtr0log.cc                    |   2 +-
 storage/innobase/mtr/mtr0mtr.cc                    |   2 +-
 storage/innobase/os/os0event.cc                    |   2 +-
 storage/innobase/os/os0file.cc                     |   2 +-
 storage/innobase/os/os0proc.cc                     |   2 +-
 storage/innobase/os/os0thread.cc                   |   2 +-
 storage/innobase/page/page0cur.cc                  |   2 +-
 storage/innobase/page/page0page.cc                 |   2 +-
 storage/innobase/page/page0zip.cc                  |   2 +-
 storage/innobase/pars/lexyy.cc                     |   2 +-
 storage/innobase/pars/make_bison.sh                |   2 +-
 storage/innobase/pars/make_flex.sh                 |   2 +-
 storage/innobase/pars/pars0grm.y                   |   2 +-
 storage/innobase/pars/pars0lex.l                   |   2 +-
 storage/innobase/pars/pars0opt.cc                  |   2 +-
 storage/innobase/pars/pars0pars.cc                 |   2 +-
 storage/innobase/pars/pars0sym.cc                  |   2 +-
 storage/innobase/que/que0que.cc                    |   2 +-
 storage/innobase/read/read0read.cc                 |   4 +-
 storage/innobase/rem/rem0cmp.cc                    |   2 +-
 storage/innobase/rem/rem0rec.cc                    |   2 +-
 storage/innobase/row/row0ext.cc                    |   2 +-
 storage/innobase/row/row0ftsort.cc                 |   3 +-
 storage/innobase/row/row0import.cc                 |   2 +-
 storage/innobase/row/row0ins.cc                    |   2 +-
 storage/innobase/row/row0log.cc                    |   2 +-
 storage/innobase/row/row0merge.cc                  |   6 +-
 storage/innobase/row/row0mysql.cc                  |   8 +-
 storage/innobase/row/row0purge.cc                  |  10 +-
 storage/innobase/row/row0quiesce.cc                |   2 +-
 storage/innobase/row/row0row.cc                    |   2 +-
 storage/innobase/row/row0sel.cc                    |   2 +-
 storage/innobase/row/row0uins.cc                   |   2 +-
 storage/innobase/row/row0umod.cc                   |   4 +-
 storage/innobase/row/row0undo.cc                   |   2 +-
 storage/innobase/row/row0upd.cc                    |   2 +-
 storage/innobase/row/row0vers.cc                   |   2 +-
 storage/innobase/snappy.cmake                      |   2 +-
 storage/innobase/srv/srv0conc.cc                   |   2 +-
 storage/innobase/srv/srv0mon.cc                    |  30 +-
 storage/innobase/srv/srv0srv.cc                    |   2 +-
 storage/innobase/srv/srv0start.cc                  |   2 +-
 storage/innobase/sync/sync0arr.cc                  |   2 +-
 storage/innobase/sync/sync0debug.cc                |   2 +-
 storage/innobase/sync/sync0rw.cc                   |   4 +-
 storage/innobase/sync/sync0sync.cc                 |   2 +-
 storage/innobase/trx/trx0i_s.cc                    |  32 +-
 storage/innobase/trx/trx0purge.cc                  |   2 +-
 storage/innobase/trx/trx0rec.cc                    |   2 +-
 storage/innobase/trx/trx0roll.cc                   |   2 +-
 storage/innobase/trx/trx0rseg.cc                   |   2 +-
 storage/innobase/trx/trx0sys.cc                    |   2 +-
 storage/innobase/trx/trx0trx.cc                    |   2 +-
 storage/innobase/trx/trx0undo.cc                   |   2 +-
 storage/innobase/ut/ut0crc32.cc                    |   4 +-
 storage/innobase/ut/ut0dbg.cc                      |   2 +-
 storage/innobase/ut/ut0list.cc                     |   2 +-
 storage/innobase/ut/ut0mem.cc                      |   2 +-
 storage/innobase/ut/ut0new.cc                      |   2 +-
 storage/innobase/ut/ut0rbt.cc                      |   2 +-
 storage/innobase/ut/ut0rnd.cc                      |   2 +-
 storage/innobase/ut/ut0timer.cc                    |  36 +-
 storage/innobase/ut/ut0ut.cc                       |   2 +-
 storage/innobase/ut/ut0vec.cc                      |   2 +-
 storage/innobase/ut/ut0wqueue.cc                   |   2 +-
 storage/maria/CMakeLists.txt                       |   2 +-
 storage/maria/ft_maria.c                           |   2 +-
 storage/maria/ha_maria.cc                          |  96 +--
 storage/maria/ha_maria.h                           |   9 +-
 storage/maria/lockman.c                            |   2 +-
 storage/maria/lockman.h                            |   2 +-
 storage/maria/ma_bitmap.c                          |   2 +-
 storage/maria/ma_blockrec.c                        |   2 +-
 storage/maria/ma_blockrec.h                        |   2 +-
 storage/maria/ma_cache.c                           |   2 +-
 storage/maria/ma_changed.c                         |   2 +-
 storage/maria/ma_check.c                           |   2 +-
 storage/maria/ma_check_standalone.h                |   2 +-
 storage/maria/ma_checkpoint.c                      |   2 +-
 storage/maria/ma_checkpoint.h                      |   2 +-
 storage/maria/ma_checksum.c                        |   2 +-
 storage/maria/ma_close.c                           |   2 +-
 storage/maria/ma_commit.c                          |   2 +-
 storage/maria/ma_commit.h                          |   2 +-
 storage/maria/ma_control_file.c                    |   2 +-
 storage/maria/ma_control_file.h                    |   2 +-
 storage/maria/ma_create.c                          |   2 +-
 storage/maria/ma_crypt.c                           |   2 +-
 storage/maria/ma_crypt.h                           |   2 +-
 storage/maria/ma_dbug.c                            |   2 +-
 storage/maria/ma_delete.c                          |   2 +-
 storage/maria/ma_delete_all.c                      |   2 +-
 storage/maria/ma_delete_table.c                    |   2 +-
 storage/maria/ma_dynrec.c                          |   2 +-
 storage/maria/ma_extra.c                           |   2 +-
 storage/maria/ma_ft_boolean_search.c               |   2 +-
 storage/maria/ma_ft_eval.c                         |   2 +-
 storage/maria/ma_ft_eval.h                         |   2 +-
 storage/maria/ma_ft_nlq_search.c                   |   2 +-
 storage/maria/ma_ft_parser.c                       |   2 +-
 storage/maria/ma_ft_stem.c                         |   2 +-
 storage/maria/ma_ft_test1.c                        |   2 +-
 storage/maria/ma_ft_test1.h                        |   2 +-
 storage/maria/ma_ft_update.c                       |   2 +-
 storage/maria/ma_ftdefs.h                          |   2 +-
 storage/maria/ma_fulltext.h                        |   2 +-
 storage/maria/ma_info.c                            |   2 +-
 storage/maria/ma_init.c                            |   2 +-
 storage/maria/ma_key.c                             |   2 +-
 storage/maria/ma_key_recover.c                     |   2 +-
 storage/maria/ma_key_recover.h                     |   2 +-
 storage/maria/ma_keycache.c                        |   2 +-
 storage/maria/ma_locking.c                         |   2 +-
 storage/maria/ma_loghandler.c                      |   2 +-
 storage/maria/ma_loghandler.h                      |   2 +-
 storage/maria/ma_loghandler_lsn.h                  |   2 +-
 storage/maria/ma_norec.c                           |   2 +-
 storage/maria/ma_open.c                            |   2 +-
 storage/maria/ma_packrec.c                         |   2 +-
 storage/maria/ma_page.c                            |   2 +-
 storage/maria/ma_pagecache.c                       |   2 +-
 storage/maria/ma_pagecache.h                       |   2 +-
 storage/maria/ma_pagecaches.c                      |   2 +-
 storage/maria/ma_pagecrc.c                         |   2 +-
 storage/maria/ma_panic.c                           |   2 +-
 storage/maria/ma_preload.c                         |   2 +-
 storage/maria/ma_range.c                           |   2 +-
 storage/maria/ma_recovery.c                        |   2 +-
 storage/maria/ma_recovery.h                        |   2 +-
 storage/maria/ma_recovery_util.c                   |   2 +-
 storage/maria/ma_recovery_util.h                   |   2 +-
 storage/maria/ma_rename.c                          |   2 +-
 storage/maria/ma_rfirst.c                          |   2 +-
 storage/maria/ma_rkey.c                            |   2 +-
 storage/maria/ma_rlast.c                           |   2 +-
 storage/maria/ma_rnext.c                           |   2 +-
 storage/maria/ma_rnext_same.c                      |   2 +-
 storage/maria/ma_rprev.c                           |   2 +-
 storage/maria/ma_rrnd.c                            |   2 +-
 storage/maria/ma_rsame.c                           |   2 +-
 storage/maria/ma_rsamepos.c                        |   2 +-
 storage/maria/ma_rt_index.c                        |   2 +-
 storage/maria/ma_rt_index.h                        |   2 +-
 storage/maria/ma_rt_key.c                          |   2 +-
 storage/maria/ma_rt_key.h                          |   2 +-
 storage/maria/ma_rt_mbr.c                          |   2 +-
 storage/maria/ma_rt_mbr.h                          |   2 +-
 storage/maria/ma_rt_split.c                        |   2 +-
 storage/maria/ma_rt_test.c                         |   2 +-
 storage/maria/ma_scan.c                            |   2 +-
 storage/maria/ma_search.c                          |   2 +-
 storage/maria/ma_servicethread.c                   |   2 +-
 storage/maria/ma_servicethread.h                   |   2 +-
 storage/maria/ma_sort.c                            |   2 +-
 storage/maria/ma_sp_defs.h                         |   2 +-
 storage/maria/ma_sp_key.c                          |   2 +-
 storage/maria/ma_sp_test.c                         |   2 +-
 storage/maria/ma_state.c                           |   2 +-
 storage/maria/ma_state.h                           |   2 +-
 storage/maria/ma_static.c                          |   2 +-
 storage/maria/ma_statrec.c                         |   2 +-
 storage/maria/ma_test1.c                           |   2 +-
 storage/maria/ma_test2.c                           |   2 +-
 storage/maria/ma_test3.c                           |   2 +-
 storage/maria/ma_trnman.h                          |   2 +-
 storage/maria/ma_unique.c                          |   2 +-
 storage/maria/ma_update.c                          |   2 +-
 storage/maria/ma_write.c                           |   6 +-
 storage/maria/maria_chk.c                          |   2 +-
 storage/maria/maria_def.h                          |   2 +-
 storage/maria/maria_dump_log.c                     |   2 +-
 storage/maria/maria_ftdump.c                       |   2 +-
 storage/maria/maria_pack.c                         |   2 +-
 storage/maria/maria_read_log.c                     |   2 +-
 storage/maria/tablockman.c                         |   2 +-
 storage/maria/tablockman.h                         |   2 +-
 storage/maria/trnman.c                             |   2 +-
 storage/maria/trnman.h                             |   2 +-
 storage/maria/trnman_public.h                      |   2 +-
 storage/maria/unittest/CMakeLists.txt              |   2 +-
 storage/maria/unittest/lockman-t.c                 |   2 +-
 storage/maria/unittest/lockman1-t.c                |   2 +-
 storage/maria/unittest/lockman2-t.c                |   2 +-
 storage/maria/unittest/ma_control_file-t.c         |   2 +-
 storage/maria/unittest/ma_loghandler_examples.c    |   2 +-
 storage/maria/unittest/ma_maria_log_cleanup.c      |   2 +-
 storage/maria/unittest/ma_pagecache_consist.c      |   2 +-
 storage/maria/unittest/ma_pagecache_rwconsist.c    |   2 +-
 storage/maria/unittest/ma_pagecache_rwconsist2.c   |   2 +-
 storage/maria/unittest/ma_pagecache_single.c       |   2 +-
 storage/maria/unittest/ma_test_loghandler-t.c      |   2 +-
 .../unittest/ma_test_loghandler_first_lsn-t.c      |   2 +-
 .../maria/unittest/ma_test_loghandler_max_lsn-t.c  |   2 +-
 .../unittest/ma_test_loghandler_multigroup-t.c     |   2 +-
 .../unittest/ma_test_loghandler_multithread-t.c    |   2 +-
 .../maria/unittest/ma_test_loghandler_noflush-t.c  |   2 +-
 .../maria/unittest/ma_test_loghandler_nologs-t.c   |   2 +-
 .../unittest/ma_test_loghandler_pagecache-t.c      |   2 +-
 .../maria/unittest/ma_test_loghandler_purge-t.c    |   2 +-
 storage/maria/unittest/sequence_storage.c          |   2 +-
 storage/maria/unittest/sequence_storage.h          |   2 +-
 storage/maria/unittest/test_file.c                 |   2 +-
 storage/maria/unittest/test_file.h                 |   2 +-
 storage/maria/unittest/trnman-t.c                  |   2 +-
 storage/mroonga/CMakeLists.txt                     |   2 +-
 storage/mroonga/COPYING                            |   4 +-
 .../mroonga/build/cmake_modules/ReadFileList.cmake |   2 +-
 storage/mroonga/config.sh.in                       |   2 +-
 storage/mroonga/ha_mroonga.cpp                     |   2 +-
 storage/mroonga/ha_mroonga.hpp                     |   2 +-
 .../mroonga/lib/mrn_auto_increment_value_lock.cpp  |   2 +-
 .../mroonga/lib/mrn_auto_increment_value_lock.hpp  |   2 +-
 storage/mroonga/lib/mrn_column_name.cpp            |   2 +-
 storage/mroonga/lib/mrn_column_name.hpp            |   2 +-
 storage/mroonga/lib/mrn_condition_converter.cpp    |   2 +-
 storage/mroonga/lib/mrn_condition_converter.hpp    |   2 +-
 storage/mroonga/lib/mrn_context_pool.cpp           |   2 +-
 storage/mroonga/lib/mrn_context_pool.hpp           |   2 +-
 storage/mroonga/lib/mrn_count_skip_checker.cpp     |   2 +-
 storage/mroonga/lib/mrn_count_skip_checker.hpp     |   2 +-
 storage/mroonga/lib/mrn_current_thread.hpp         |   2 +-
 storage/mroonga/lib/mrn_database.cpp               |   2 +-
 storage/mroonga/lib/mrn_database.hpp               |   2 +-
 storage/mroonga/lib/mrn_database_manager.cpp       |   2 +-
 storage/mroonga/lib/mrn_database_manager.hpp       |   2 +-
 storage/mroonga/lib/mrn_database_repairer.cpp      |   2 +-
 storage/mroonga/lib/mrn_database_repairer.hpp      |   2 +-
 storage/mroonga/lib/mrn_debug_column_access.cpp    |   2 +-
 storage/mroonga/lib/mrn_debug_column_access.hpp    |   2 +-
 storage/mroonga/lib/mrn_encoding.cpp               |   2 +-
 storage/mroonga/lib/mrn_encoding.hpp               |   2 +-
 storage/mroonga/lib/mrn_external_lock.cpp          |   2 +-
 storage/mroonga/lib/mrn_external_lock.hpp          |   2 +-
 storage/mroonga/lib/mrn_field_normalizer.cpp       |   2 +-
 storage/mroonga/lib/mrn_field_normalizer.hpp       |   2 +-
 storage/mroonga/lib/mrn_grn.hpp                    |   2 +-
 storage/mroonga/lib/mrn_index_column_name.cpp      |   2 +-
 storage/mroonga/lib/mrn_index_column_name.hpp      |   2 +-
 storage/mroonga/lib/mrn_index_table_name.cpp       |   2 +-
 storage/mroonga/lib/mrn_index_table_name.hpp       |   2 +-
 storage/mroonga/lib/mrn_lock.cpp                   |   2 +-
 storage/mroonga/lib/mrn_lock.hpp                   |   2 +-
 .../lib/mrn_match_escalation_threshold_scope.cpp   |   2 +-
 .../lib/mrn_match_escalation_threshold_scope.hpp   |   2 +-
 .../mroonga/lib/mrn_multiple_column_key_codec.cpp  |   2 +-
 .../mroonga/lib/mrn_multiple_column_key_codec.hpp  |   2 +-
 storage/mroonga/lib/mrn_mysqlservices.cpp          |   2 +-
 storage/mroonga/lib/mrn_operation.cpp              |   2 +-
 storage/mroonga/lib/mrn_operation.hpp              |   2 +-
 storage/mroonga/lib/mrn_operations.cpp             |   2 +-
 storage/mroonga/lib/mrn_operations.hpp             |   2 +-
 storage/mroonga/lib/mrn_parameters_parser.cpp      |   2 +-
 storage/mroonga/lib/mrn_parameters_parser.hpp      |   2 +-
 storage/mroonga/lib/mrn_path_mapper.cpp            |   2 +-
 storage/mroonga/lib/mrn_path_mapper.hpp            |   2 +-
 storage/mroonga/lib/mrn_query_parser.cpp           |   2 +-
 storage/mroonga/lib/mrn_query_parser.hpp           |   2 +-
 storage/mroonga/lib/mrn_smart_bitmap.cpp           |   2 +-
 storage/mroonga/lib/mrn_smart_bitmap.hpp           |   2 +-
 storage/mroonga/lib/mrn_smart_grn_obj.cpp          |   2 +-
 storage/mroonga/lib/mrn_smart_grn_obj.hpp          |   2 +-
 .../mroonga/lib/mrn_table_fields_offset_mover.cpp  |   2 +-
 .../mroonga/lib/mrn_table_fields_offset_mover.hpp  |   2 +-
 storage/mroonga/lib/mrn_time_converter.cpp         |   2 +-
 storage/mroonga/lib/mrn_time_converter.hpp         |   2 +-
 storage/mroonga/lib/mrn_value_decoder.cpp          |   2 +-
 storage/mroonga/lib/mrn_value_decoder.hpp          |   2 +-
 storage/mroonga/lib/mrn_windows.hpp                |   2 +-
 storage/mroonga/mrn_constants.hpp                  |   2 +-
 storage/mroonga/mrn_err.h                          |   2 +-
 storage/mroonga/mrn_macro.hpp                      |   2 +-
 storage/mroonga/mrn_mysql.h                        |   2 +-
 storage/mroonga/mrn_mysql_compat.h                 |   2 +-
 storage/mroonga/mrn_table.cpp                      |   2 +-
 storage/mroonga/mrn_table.hpp                      |   2 +-
 storage/mroonga/mrn_variables.hpp                  |   2 +-
 storage/mroonga/mrn_version.h.in                   |   2 +-
 .../mroonga/include/mroonga/check_64bit.inc        |   2 +-
 .../mroonga/include/mroonga/check_freebsd.inc      |   2 +-
 .../include/mroonga/check_ha_mroonga_so.inc        |   2 +-
 .../include/mroonga/check_libgroonga_embedded.inc  |   2 +-
 .../mroonga/check_libgroonga_support_lz4.inc       |   2 +-
 .../mroonga/check_libgroonga_support_zlib.inc      |   2 +-
 .../mroonga/check_libgroonga_support_zstd.inc      |   2 +-
 .../mroonga/include/mroonga/check_mariadb.inc      |   2 +-
 .../mroonga/include/mroonga/check_osx.inc          |   2 +-
 .../mroonga/include/mroonga/check_solaris.inc      |   2 +-
 .../include/mroonga/check_strict_sql_mode.inc      |   2 +-
 .../mroonga/include/mroonga/check_version.inc      |   2 +-
 .../mroonga/include/mroonga/check_windows.inc      |   2 +-
 .../include/mroonga/have_fractional_seconds.inc    |   2 +-
 .../mroonga/include/mroonga/have_freebsd.inc       |   2 +-
 .../mroonga/have_groonga_plugin_register.inc       |   2 +-
 .../mroonga/include/mroonga/have_mariadb.inc       |   2 +-
 .../include/mroonga/have_mariadb_10_2_or_later.inc |   2 +-
 .../mroonga/include/mroonga/have_mroonga.inc       |   2 +-
 .../include/mroonga/have_mroonga_deinit.inc        |   2 +-
 .../include/mroonga/have_mroonga_helper.inc        |   2 +-
 .../mroonga/include/mroonga/have_mysql.inc         |   2 +-
 .../include/mroonga/have_mysql_5_7_or_later.inc    |   2 +-
 .../include/mroonga/have_signed_64bit_time_t.inc   |   2 +-
 .../mroonga/include/mroonga/have_solaris.inc       |   2 +-
 .../include/mroonga/have_strict_sql_mode.inc       |   2 +-
 .../mroonga/include/mroonga/have_version_10_0.inc  |   2 +-
 .../include/mroonga/have_version_10_0_or_later.inc |   2 +-
 .../mroonga/include/mroonga/have_version_5_5.inc   |   2 +-
 .../mroonga/include/mroonga/have_version_5_6.inc   |   2 +-
 .../include/mroonga/have_version_5_6_or_later.inc  |   2 +-
 .../mroonga/include/mroonga/have_version_5_7.inc   |   2 +-
 .../include/mroonga/have_version_5_7_or_later.inc  |   2 +-
 .../include/mroonga/load_mroonga_functions.inc     |   2 +-
 .../mroonga/include/mroonga/skip_freebsd.inc       |   2 +-
 .../include/mroonga/skip_mariadb_10_0_or_later.inc |   2 +-
 .../mroonga/include/mroonga/skip_mariadb_10_1.inc  |   2 +-
 .../mroonga/skip_mariadb_10_1_or_earlier.inc       |   2 +-
 .../include/mroonga/skip_mariadb_10_2_or_later.inc |   2 +-
 .../mroonga/include/mroonga/skip_mariadb_5_5.inc   |   2 +-
 .../mroonga/include/mroonga/skip_mysql_5_5.inc     |   2 +-
 .../mroonga/include/mroonga/skip_mysql_5_7.inc     |   2 +-
 .../include/mroonga/skip_mysql_5_7_or_later.inc    |   2 +-
 .../mroonga/include/mroonga/skip_osx.inc           |   2 +-
 .../include/mroonga/skip_signed_64bit_time_t.inc   |   2 +-
 .../mroonga/include/mroonga/skip_solaris.inc       |   2 +-
 .../include/mroonga/skip_strict_sql_mode.inc       |   2 +-
 .../include/mroonga/support_libgroonga_lz4.inc     |   2 +-
 .../include/mroonga/support_libgroonga_zlib.inc    |   2 +-
 .../include/mroonga/support_libgroonga_zstd.inc    |   2 +-
 .../include/mroonga/unload_mroonga_functions.inc   |   2 +-
 .../include/mroonga/unsupport_libgroonga_lz4.inc   |   2 +-
 .../include/mroonga/unsupport_libgroonga_zlib.inc  |   2 +-
 .../include/mroonga/unsupport_libgroonga_zstd.inc  |   2 +-
 .../storage/t/alter_table_add_column_after.test    |   2 +-
 .../storage/t/alter_table_add_column_first.test    |   2 +-
 .../t/alter_table_add_column_flags_comment.test    |   2 +-
 .../t/alter_table_add_column_flags_parameter.test  |   2 +-
 ...lter_table_add_column_groonga_type_comment.test |   2 +-
 ...er_table_add_column_groonga_type_parameter.test |   2 +-
 .../t/alter_table_add_column_multibyte_cp932.test  |   2 +-
 .../t/alter_table_add_column_multibyte_utf8.test   |   2 +-
 .../storage/t/alter_table_add_column_multiple.test |   2 +-
 .../storage/t/alter_table_add_column_plain.test    |   2 +-
 .../t/alter_table_add_column_type_comment.test     |   2 +-
 ...e_add_index_token_filters_one_token_filter.test |   2 +-
 .../t/alter_table_add_index_unique_duplicated.test |   2 +-
 ...dd_index_unique_multiple_column_duplicated.test |   2 +-
 ...er_table_add_key_multiple_column_with_data.test |   2 +-
 .../storage/t/alter_table_add_primary_key.test     |   2 +-
 ...able_change_column_comment_not_for_mroonga.test |   2 +-
 .../t/alter_table_change_column_have_index.test    |   2 +-
 .../t/alter_table_change_column_rename_after.test  |   2 +-
 .../t/alter_table_change_column_rename_first.test  |   2 +-
 .../alter_table_change_column_rename_multiple.test |   2 +-
 .../alter_table_change_column_rename_no_order.test |   2 +-
 .../t/alter_table_change_engine_decimal.test       |   2 +-
 .../alter_table_change_engine_fulltext_index.test  |   2 +-
 .../storage/t/alter_table_change_token_filter.test |   2 +-
 .../alter_table_disable_keys_create_fulltext.test  |   2 +-
 .../t/alter_table_disable_keys_fulltext_table.test |   2 +-
 .../t/alter_table_disable_keys_fulltext_ujis.test  |   2 +-
 .../t/alter_table_disable_keys_fulltext_utf8.test  |   2 +-
 .../alter_table_disable_keys_multiple_column.test  |   2 +-
 .../storage/t/alter_table_disable_keys_normal.test |   2 +-
 .../t/alter_table_disable_keys_primary.test        |   2 +-
 .../t/alter_table_disable_keys_truncate.test       |   2 +-
 .../t/alter_table_disable_keys_updating.test       |   2 +-
 .../t/alter_table_drop_column_multiple.test        |   2 +-
 .../storage/t/alter_table_drop_column_one.test     |   2 +-
 ...r_table_drop_key_multiple_column_with_data.test |   2 +-
 .../storage/t/alter_table_drop_primary_key.test    |   2 +-
 .../t/alter_table_enable_keys_fulltext.test        |   2 +-
 .../t/alter_table_enable_keys_fulltext_table.test  |   2 +-
 .../t/alter_table_enable_keys_fulltext_ujis.test   |   2 +-
 .../t/alter_table_enable_keys_fulltext_utf8.test   |   2 +-
 .../t/alter_table_enable_keys_multiple_column.test |   2 +-
 .../storage/t/alter_table_enable_keys_normal.test  |   2 +-
 .../storage/t/alter_table_enable_keys_primary.test |   2 +-
 .../t/alter_table_fulltext_add_no_primary_key.test |   2 +-
 .../storage/t/alter_table_fulltext_add_normal.test |   2 +-
 .../storage/t/alter_table_fulltext_add_table.test  |   2 +-
 .../storage/t/alter_table_fulltext_drop_table.test |   2 +-
 .../storage/t/alter_table_modify_column_after.test |   2 +-
 .../storage/t/alter_table_modify_column_first.test |   2 +-
 .../t/alter_table_modify_column_no_order.test      |   2 +-
 ...ter_table_recreate_anonymous_index_at_once.test |   2 +-
 .../storage/t/alter_table_rename_table.test        |   2 +-
 .../mroonga/storage/t/alter_table_spatial.test     |   2 +-
 .../storage/t/auto_increment_TODO_SPLIT_ME.test    |   2 +-
 .../storage/t/auto_increment_table_param.test      |   2 +-
 .../mroonga/storage/t/auto_increment_text.test     |   2 +-
 .../mroonga/storage/t/binlog_TODO_SPLIT_ME.test    |   2 +-
 .../mroonga/storage/t/check_table_broken.test      |   2 +-
 .../mroonga/storage/t/check_table_not_broken.test  |   2 +-
 .../t/collation_utf8_general_ci_french.test        |   2 +-
 .../t/collation_utf8_unicode_520_ci_french.test    |   2 +-
 .../t/collation_utf8_unicode_520_ci_japanese.test  |   2 +-
 .../t/collation_utf8_unicode_ci_french.test        |   2 +-
 .../t/collation_utf8_unicode_ci_japanese.test      |   2 +-
 .../t/column_comment_index_not_for_mroonga.test    |   2 +-
 .../t/column_comment_normal_not_for_mroonga.test   |   2 +-
 .../mroonga/storage/t/column_date_with_index.test  |   2 +-
 .../storage/t/column_date_without_index.test       |   2 +-
 .../mroonga/storage/t/column_date_zero_date.test   |   2 +-
 .../storage/t/column_datetime_32bit_2038.test      |   2 +-
 .../t/column_datetime_32bit_before_unix_epoch.test |   2 +-
 .../storage/t/column_datetime_32bit_max.test       |   2 +-
 .../t/column_datetime_32bit_out_of_range.test      |   2 +-
 .../storage/t/column_datetime_64bit_2038.test      |   2 +-
 .../t/column_datetime_64bit_before_unix_epoch.test |   2 +-
 .../storage/t/column_datetime_64bit_max.test       |   2 +-
 ...atetime_64bit_strict_sql_mode_out_of_range.test |   2 +-
 ...mn_datetime_64bit_version_5_5_out_of_range.test |   2 +-
 ...me_64bit_version_5_6_or_later_out_of_range.test |   2 +-
 ...umn_datetime_fractional_seconds_with_index.test |   2 +-
 ..._datetime_fractional_seconds_without_index.test |   2 +-
 .../column_datetime_freebsd_before_unix_epoch.test |   2 +-
 ...n_datetime_mariadb_10_2_or_later_zero_date.test |   2 +-
 ...etime_mariadb_10_2_or_later_zero_month_day.test |   2 +-
 ...lumn_datetime_mysql_5_7_or_later_zero_date.test |   2 +-
 ...datetime_mysql_5_7_or_later_zero_month_day.test |   2 +-
 .../mroonga/storage/t/column_datetime_null.test    |   2 +-
 .../storage/t/column_datetime_with_index.test      |   2 +-
 .../storage/t/column_datetime_without_index.test   |   2 +-
 .../storage/t/column_datetime_zero_date.test       |   2 +-
 .../storage/t/column_datetime_zero_month_day.test  |   2 +-
 ...lumn_decimal_fractional_seconds_with_index.test |   2 +-
 ...n_decimal_fractional_seconds_without_index.test |   2 +-
 .../storage/t/column_decimal_with_index.test       |   2 +-
 .../storage/t/column_decimal_without_index.test    |   2 +-
 .../storage/t/column_enum_less_with_index.test     |   2 +-
 .../storage/t/column_enum_many_with_index.test     |   2 +-
 .../t/column_generated_stored_add_column.test      |   2 +-
 .../storage/t/column_generated_stored_delete.test  |   2 +-
 .../t/column_generated_stored_drop_column.test     |   2 +-
 .../storage/t/column_generated_stored_insert.test  |   2 +-
 .../storage/t/column_generated_stored_reindex.test |   2 +-
 .../storage/t/column_generated_stored_update.test  |   2 +-
 .../t/column_generated_virtual_add_column.test     |   2 +-
 .../storage/t/column_generated_virtual_delete.test |   2 +-
 .../t/column_generated_virtual_drop_column.test    |   2 +-
 .../storage/t/column_generated_virtual_insert.test |   2 +-
 ...ed_virtual_mariadb_10_2_or_later_add_index.test |   2 +-
 ...iadb_10_2_or_later_create_table_with_index.test |   2 +-
 ...rated_virtual_mysql_5_7_or_later_add_index.test |   2 +-
 .../storage/t/column_generated_virtual_update.test |   2 +-
 .../mroonga/storage/t/column_groonga__id__id.test  |   2 +-
 .../storage/t/column_groonga__id_invalid_id.test   |   2 +-
 .../column_groonga_index_fulltext_other_table.test |   2 +-
 ..._groonga_index_fulltext_vector_other_table.test |   2 +-
 .../t/column_groonga_index_int_other_table.test    |   2 +-
 .../storage/t/column_groonga_scalar_reference.test |   2 +-
 .../t/column_groonga_scalar_support_lz4.test       |   2 +-
 .../t/column_groonga_scalar_support_zlib.test      |   2 +-
 .../t/column_groonga_scalar_support_zstd.test      |   2 +-
 .../t/column_groonga_scalar_unsupport_lz4.test     |   2 +-
 .../t/column_groonga_scalar_unsupport_zlib.test    |   2 +-
 .../t/column_groonga_scalar_unsupport_zstd.test    |   2 +-
 ...roonga_scalar_with_not_for_mroonga_comment.test |   2 +-
 ...lumn_groonga_vector_order_by_with_function.test |   2 +-
 .../storage/t/column_groonga_vector_reference.test |   2 +-
 .../t/column_int_with_index_zero_value.test        |   2 +-
 .../mroonga/storage/t/column_json_insert.test      |   2 +-
 .../mroonga/storage/t/column_multibyte_cp932.test  |   2 +-
 .../mroonga/storage/t/column_multibyte_utf8.test   |   2 +-
 .../storage/t/column_set_16_with_index.test        |   2 +-
 .../storage/t/column_set_24_with_index.test        |   2 +-
 .../storage/t/column_set_32_with_index.test        |   2 +-
 .../storage/t/column_set_64_with_index.test        |   2 +-
 .../mroonga/storage/t/column_set_8_with_index.test |   2 +-
 .../storage/t/column_signed_bigint_with_index.test |   2 +-
 .../storage/t/column_signed_int_with_index.test    |   2 +-
 .../t/column_signed_mediumint_with_index.test      |   2 +-
 .../t/column_signed_smallint_with_index.test       |   2 +-
 .../t/column_signed_tinyint_with_index.test        |   2 +-
 .../column_time_fractional_seconds_with_index.test |   2 +-
 .../mroonga/storage/t/column_time_with_index.test  |   2 +-
 ...mn_timestamp_fractional_seconds_with_index.test |   2 +-
 .../storage/t/column_timestamp_with_index.test     |   2 +-
 .../storage/t/column_tinyint_without_index.test    |   2 +-
 .../t/column_unsigned_bigint_with_index.test       |   2 +-
 .../t/column_unsigned_bigint_without_index.test    |   2 +-
 .../storage/t/column_unsigned_int_with_index.test  |   2 +-
 .../t/column_unsigned_mediumint_with_index.test    |   2 +-
 .../t/column_unsigned_smallint_with_index.test     |   2 +-
 .../t/column_unsigned_tinyint_with_index.test      |   2 +-
 .../mroonga/storage/t/column_year_with_index.test  |   2 +-
 .../storage/t/column_year_without_index.test       |   2 +-
 .../mysql-test/mroonga/storage/t/count_star.test   |   2 +-
 .../storage/t/create_database_name_slash.test      |   2 +-
 .../storage/t/create_table_TODO_SPLIT_ME.test      |   2 +-
 .../t/create_table_column_flags_comment.test       |   2 +-
 .../t/create_table_column_flags_parameter.test     |   2 +-
 .../create_table_column_groonga_type_comment.test  |   2 +-
 ...eate_table_column_groonga_type_nonexistent.test |   2 +-
 ...create_table_column_groonga_type_parameter.test |   2 +-
 .../t/create_table_column_type_comment.test        |   2 +-
 .../t/create_table_column_type_nonexistent.test    |   2 +-
 .../storage/t/create_table_comment_normal.test     |   2 +-
 .../storage/t/create_table_default_tokenizer.test  |   2 +-
 .../t/create_table_index_flags_comment.test        |   2 +-
 .../t/create_table_index_flags_index_medium.test   |   2 +-
 .../t/create_table_index_flags_index_small.test    |   2 +-
 .../storage/t/create_table_index_flags_none.test   |   2 +-
 .../t/create_table_index_flags_parameter.test      |   2 +-
 .../t/create_table_index_index_flags_none.test     |   2 +-
 ..._index_flags_with_position_and_with_weight.test |   2 +-
 .../t/create_table_index_normalizer_comment.test   |   2 +-
 ..._table_index_normalizer_fulltext_index_bin.test |   2 +-
 .../t/create_table_index_normalizer_index_bin.test |   2 +-
 ...lizer_no_utf8_charset_with_utf8_normalizer.test |   2 +-
 .../t/create_table_index_normalizer_none.test      |   2 +-
 .../t/create_table_index_normalizer_parameter.test |   2 +-
 .../t/create_table_index_parser_comment.test       |   2 +-
 .../t/create_table_index_parser_default.test       |   2 +-
 .../storage/t/create_table_index_parser_off.test   |   2 +-
 ...index_token_filters_multiple_token_filters.test |   2 +-
 ...table_index_token_filters_one_token_filter.test |   2 +-
 ...create_table_index_token_filters_parameter.test |   2 +-
 .../t/create_table_index_tokenizer_comment.test    |   2 +-
 .../t/create_table_index_tokenizer_default.test    |   2 +-
 .../t/create_table_index_tokenizer_off.test        |   2 +-
 .../t/create_table_index_tokenizer_parameter.test  |   2 +-
 .../t/create_table_table_normalizer_default.test   |   2 +-
 .../t/create_table_table_normalizer_hash.test      |   2 +-
 ...table_token_filters_multiple_token_filters.test |   2 +-
 ...table_table_token_filters_one_token_filter.test |   2 +-
 ...create_table_table_token_filters_stop_word.test |   2 +-
 .../mroonga/storage/t/delete_fulltext_column.test  |   2 +-
 .../storage/t/delete_index_btree_many_records.test |   2 +-
 .../storage/t/delete_index_hash_id_no_unique.test  |   2 +-
 .../storage/t/delete_index_hash_id_unique.test     |   2 +-
 .../mroonga/storage/t/delete_normal_column.test    |   2 +-
 .../mroonga/storage/t/delete_unsigned_bigint.test  |   2 +-
 .../storage/t/drop_database_TODO_SPLIT_ME.test     |   2 +-
 .../mroonga/storage/t/drop_database_no_table.test  |   2 +-
 .../storage/t/drop_table_TODO_SPLIT_ME.test        |   2 +-
 .../mysql-test/mroonga/storage/t/flush_logs.test   |   2 +-
 .../mroonga/storage/t/foreign_key_alter_add.test   |   2 +-
 .../mroonga/storage/t/foreign_key_alter_drop.test  |   2 +-
 .../mroonga/storage/t/foreign_key_create.test      |   2 +-
 .../storage/t/foreign_key_delete_existent.test     |   2 +-
 .../storage/t/foreign_key_delete_nonexistent.test  |   2 +-
 .../storage/t/foreign_key_insert_existent.test     |   2 +-
 .../storage/t/foreign_key_insert_nonexistent.test  |   2 +-
 .../mroonga/storage/t/foreign_key_rename.test      |   2 +-
 .../storage/t/foreign_key_update_existent.test     |   2 +-
 .../storage/t/foreign_key_update_nonexistent.test  |   2 +-
 .../t/fulltext_boolean_mode_empty_query.test       |   2 +-
 .../storage/t/fulltext_boolean_mode_escape.test    |   2 +-
 .../t/fulltext_boolean_mode_leading_not.test       |   2 +-
 .../t/fulltext_boolean_mode_pragma_all.test        |   2 +-
 ..._pragma_default_operator_minus_no_operator.test |   2 +-
 ...mode_pragma_default_operator_minus_with_or.test |   2 +-
 ...de_pragma_default_operator_minus_with_plus.test |   2 +-
 ...ode_pragma_default_operator_or_no_operator.test |   2 +-
 ...mode_pragma_default_operator_or_with_minus.test |   2 +-
 ..._mode_pragma_default_operator_or_with_plus.test |   2 +-
 ...e_pragma_default_operator_plus_no_operator.test |   2 +-
 ...pragma_default_operator_plus_with_astarisk.test |   2 +-
 ...de_pragma_default_operator_plus_with_minus.test |   2 +-
 ..._mode_pragma_default_operator_plus_with_or.test |   2 +-
 ...boolean_mode_pragma_syntax_script_operator.test |   2 +-
 ...boolean_mode_pragma_syntax_script_selector.test |   2 +-
 ...ltext_boolean_mode_pragma_weight_full_spec.test |   2 +-
 ...ltext_boolean_mode_pragma_weight_no_weight.test |   2 +-
 ...xt_boolean_mode_pragma_weight_omit_section.test |   2 +-
 ...an_mode_pragma_weight_ten_or_more_sections.test |   2 +-
 ..._mode_pragma_weight_three_or_more_sections.test |   2 +-
 .../fulltext_boolean_mode_syntax_error_error.test  |   2 +-
 ...xt_boolean_mode_syntax_error_error_and_log.test |   2 +-
 .../fulltext_boolean_mode_syntax_error_ignore.test |   2 +-
 ...t_boolean_mode_syntax_error_ignore_and_log.test |   2 +-
 .../mroonga/storage/t/fulltext_charset_ascii.test  |   2 +-
 .../mroonga/storage/t/fulltext_charset_cp932.test  |   2 +-
 .../storage/t/fulltext_charset_eucjpms.test        |   2 +-
 .../storage/t/fulltext_charset_japanese.test       |   2 +-
 .../storage/t/fulltext_charset_utf8mb4.test        |   2 +-
 .../mroonga/storage/t/fulltext_empty_query.test    |   2 +-
 .../mroonga/storage/t/fulltext_found_rows.test     |   2 +-
 .../storage/t/fulltext_groonga_varchar_vector.test |   2 +-
 .../mroonga/storage/t/fulltext_index_recreate.test |   2 +-
 .../mroonga/storage/t/fulltext_insert_select.test  |   2 +-
 .../mroonga/storage/t/fulltext_insert_values.test  |   2 +-
 .../t/fulltext_multiple_column_index_delete.test   |   2 +-
 .../t/fulltext_multiple_column_index_insert.test   |   2 +-
 .../t/fulltext_multiple_column_index_recreate.test |   2 +-
 .../t/fulltext_multiple_column_index_update.test   |   2 +-
 .../mroonga/storage/t/fulltext_multiple_index.test |   2 +-
 .../mroonga/storage/t/fulltext_no_primary_key.test |   2 +-
 .../storage/t/fulltext_not_match_against.test      |   2 +-
 .../mysql-test/mroonga/storage/t/fulltext_or.test  |   2 +-
 ...ltext_order_boolean_mode_different_against.test |   2 +-
 ...ulltext_order_boolean_mode_different_match.test |   2 +-
 .../t/fulltext_order_boolean_mode_no_where.test    |   2 +-
 ...text_order_boolean_mode_same_match_against.test |   2 +-
 .../fulltext_order_natural_language_mode_asc.test  |   2 +-
 .../fulltext_order_natural_language_mode_desc.test |   2 +-
 ...er_natural_language_mode_different_against.test |   2 +-
 ...rder_natural_language_mode_different_match.test |   2 +-
 ...ltext_order_natural_language_mode_no_where.test |   2 +-
 ...r_natural_language_mode_same_match_against.test |   2 +-
 .../mroonga/storage/t/fulltext_two_inner_join.test |   2 +-
 .../t/fulltext_version_10_0_no_such_key.test       |   2 +-
 .../t/fulltext_version_5_5_no_such_key.test        |   2 +-
 .../t/fulltext_version_5_6_no_such_key.test        |   2 +-
 .../storage/t/function_command_auto-escape.test    |   2 +-
 .../mroonga/storage/t/function_command_select.test |   2 +-
 .../t/function_command_special-database-name.test  |   2 +-
 .../t/function_escape_error_query_is_missing.test  |   2 +-
 .../function_escape_error_query_is_not_string.test |   2 +-
 ...cape_error_target_characters_is_not_string.test |   2 +-
 .../storage/t/function_escape_query_all.test       |   2 +-
 .../storage/t/function_escape_query_custom.test    |   2 +-
 .../storage/t/function_escape_query_join.test      |   2 +-
 .../t/function_escape_query_match_against.test     |   2 +-
 .../storage/t/function_escape_query_named.test     |   2 +-
 .../storage/t/function_escape_query_nested.test    |   2 +-
 .../storage/t/function_escape_script_decimal.test  |   2 +-
 .../storage/t/function_escape_script_integer.test  |   2 +-
 .../storage/t/function_escape_script_real.test     |   2 +-
 .../storage/t/function_escape_script_string.test   |   2 +-
 .../t/function_highlight_html_dynamic_keyword.test |   2 +-
 .../t/function_highlight_html_japanese.test        |   2 +-
 .../function_highlight_html_multiple_keywords.test |   2 +-
 .../t/function_highlight_html_normalizer.test      |   2 +-
 .../storage/t/function_highlight_html_query.test   |   2 +-
 .../t/function_highlight_html_query_pragma.test    |   2 +-
 .../storage/t/function_highlight_html_record.test  |   2 +-
 .../storage/t/function_last_insert_grn_id.test     |   2 +-
 .../t/function_last_insert_id_reference.test       |   2 +-
 .../storage/t/function_last_insert_id_set.test     |   2 +-
 .../storage/t/function_normalize_default.test      |   2 +-
 .../storage/t/function_normalize_normalizer.test   |   2 +-
 .../storage/t/function_normalize_record.test       |   2 +-
 .../storage/t/function_query_expand_multiple.test  |   2 +-
 .../storage/t/function_query_expand_no_index.test  |   2 +-
 .../storage/t/function_query_expand_one.test       |   2 +-
 .../storage/t/function_query_expand_pragma.test    |   2 +-
 .../mroonga/storage/t/function_snippet_ascii.test  |   2 +-
 .../mroonga/storage/t/function_snippet_cp932.test  |   2 +-
 .../storage/t/function_snippet_eucjpms.test        |   2 +-
 .../t/function_snippet_html_dynamic_keyword.test   |   2 +-
 .../storage/t/function_snippet_html_japanese.test  |   2 +-
 .../t/function_snippet_html_multiple_keywords.test |   2 +-
 .../t/function_snippet_html_multiple_snippets.test |   2 +-
 .../storage/t/function_snippet_html_query.test     |   2 +-
 .../t/function_snippet_html_query_pragma.test      |   2 +-
 .../storage/t/function_snippet_html_record.test    |   2 +-
 ...nction_snippet_invalid_nonexistent_charset.test |   2 +-
 ...nction_snippet_invalid_unsupported_charset.test |   2 +-
 .../storage/t/function_snippet_japanese.test       |   2 +-
 .../storage/t/geometry_bulk_insert_null.test       |   2 +-
 .../mroonga/storage/t/geometry_contains.test       |   2 +-
 .../geometry_strict_sql_mode_bulk_insert_null.test |   2 +-
 .../t/geometry_strict_sql_mode_contains.test       |   2 +-
 .../storage/t/index_btree_equal_datetime.test      |   2 +-
 .../mroonga/storage/t/index_btree_equal_time.test  |   2 +-
 .../storage/t/index_btree_equal_timestamp.test     |   2 +-
 .../t/index_btree_normal_column_insert.test        |   2 +-
 .../mroonga/storage/t/index_hash_id_normal.test    |   2 +-
 .../mroonga/storage/t/index_hash_id_primary.test   |   2 +-
 .../mroonga/storage/t/index_hash_id_unique.test    |   2 +-
 .../storage/t/index_hash_normal_column_insert.test |   2 +-
 .../t/index_hash_strict_sql_mode_id_primary.test   |   2 +-
 .../storage/t/index_multiple_column_delete.test    |   2 +-
 .../t/index_multiple_column_nullable_smallint.test |   2 +-
 ...x_multiple_column_nullable_unsigned_bigint.test |   2 +-
 ...ndex_multiple_column_nullable_unsigned_int.test |   2 +-
 ...multiple_column_nullable_unsigned_smallint.test |   2 +-
 .../t/index_multiple_column_nullable_varchar.test  |   2 +-
 ...ltiple_column_order_by_where_equal_asc_asc.test |   2 +-
 ...iple_column_order_by_where_equal_desc_desc.test |   2 +-
 .../t/index_multiple_column_primary_delete.test    |   2 +-
 .../index_multiple_column_primary_select_int.test  |   2 +-
 ...iple_column_primary_strict_sql_mode_update.test |   2 +-
 .../t/index_multiple_column_primary_update.test    |   2 +-
 ...ultiple_column_range_all_used_greater_than.test |   2 +-
 ...olumn_range_all_used_greater_than_or_equal.test |   2 +-
 ...x_multiple_column_range_all_used_less_than.test |   2 +-
 ...e_column_range_all_used_less_than_or_equal.test |   2 +-
 ...ge_partially_used_have_prefix_greater_than.test |   2 +-
 ...lly_used_have_prefix_greater_than_or_equal.test |   2 +-
 ...range_partially_used_have_prefix_less_than.test |   2 +-
 ...tially_used_have_prefix_less_than_or_equal.test |   2 +-
 ...ange_partially_used_no_prefix_greater_than.test |   2 +-
 ...ially_used_no_prefix_greater_than_or_equal.test |   2 +-
 ...n_range_partially_used_no_prefix_less_than.test |   2 +-
 ...artially_used_no_prefix_less_than_or_equal.test |   2 +-
 .../storage/t/index_multiple_column_recreate.test  |   2 +-
 .../storage/t/index_multiple_column_replace.test   |   2 +-
 .../t/index_multiple_column_select_double.test     |   2 +-
 .../t/index_multiple_column_select_float.test      |   2 +-
 .../t/index_multiple_column_select_int.test        |   2 +-
 .../t/index_multiple_column_select_max.test        |   2 +-
 .../t/index_multiple_column_select_min.test        |   2 +-
 .../t/index_multiple_column_select_string.test     |   2 +-
 .../t/index_multiple_column_select_varchar.test    |   2 +-
 ...ex_multiple_column_unique_date_32bit_equal.test |   2 +-
 ...ex_multiple_column_unique_date_64bit_equal.test |   2 +-
 ...dex_multiple_column_unique_date_index_read.test |   2 +-
 ...ultiple_column_unique_date_order_32bit_asc.test |   2 +-
 ...ltiple_column_unique_date_order_32bit_desc.test |   2 +-
 ...ultiple_column_unique_date_order_64bit_asc.test |   2 +-
 ...ltiple_column_unique_date_order_64bit_desc.test |   2 +-
 ...index_multiple_column_unique_date_reinsert.test |   2 +-
 ...multiple_column_unique_datetime_index_read.test |   2 +-
 ...atetime_insert_delete_insert_invalid_value.test |   2 +-
 ..._multiple_column_unique_datetime_order_asc.test |   2 +-
 ...multiple_column_unique_datetime_order_desc.test |   2 +-
 ...x_multiple_column_unique_datetime_reinsert.test |   2 +-
 .../t/index_multiple_column_unique_decimal.test    |   2 +-
 ...dex_multiple_column_unique_time_index_read.test |   2 +-
 ...ndex_multiple_column_unique_time_order_asc.test |   2 +-
 ...dex_multiple_column_unique_time_order_desc.test |   2 +-
 ...index_multiple_column_unique_time_reinsert.test |   2 +-
 ...ultiple_column_unique_timestamp_index_read.test |   2 +-
 ...multiple_column_unique_timestamp_order_asc.test |   2 +-
 ...ultiple_column_unique_timestamp_order_desc.test |   2 +-
 ..._multiple_column_unique_timestamp_reinsert.test |   2 +-
 .../t/index_multiple_column_unique_varchar.test    |   2 +-
 ...ex_multiple_column_unique_year_32bit_equal.test |   2 +-
 ...ex_multiple_column_unique_year_64bit_equal.test |   2 +-
 ...dex_multiple_column_unique_year_index_read.test |   2 +-
 ...ultiple_column_unique_year_order_32bit_asc.test |   2 +-
 ...ltiple_column_unique_year_order_32bit_desc.test |   2 +-
 ...ultiple_column_unique_year_order_64bit_asc.test |   2 +-
 ...ltiple_column_unique_year_order_64bit_desc.test |   2 +-
 ...index_multiple_column_unique_year_reinsert.test |   2 +-
 .../t/index_multiple_column_update_int.test        |   2 +-
 .../t/index_multiple_column_update_string.test     |   2 +-
 .../storage/t/index_primary_char_exact_length.test |   2 +-
 .../t/index_primary_char_null_character.test       |   2 +-
 .../storage/t/index_primary_char_short.test        |   2 +-
 .../mroonga/storage/t/index_primary_date.test      |   2 +-
 ...x_primary_datetime_with_fractional_seconds.test |   2 +-
 ...rimary_datetime_without_fractional_seconds.test |   2 +-
 ...ex_primary_decimal_with_fractional_seconds.test |   2 +-
 ...primary_decimal_without_fractional_seconds.test |   2 +-
 ...index_primary_time_with_fractional_seconds.test |   2 +-
 ...ex_primary_time_without_fractional_seconds.test |   2 +-
 ..._primary_timestamp_with_fractional_seconds.test |   2 +-
 ...imary_timestamp_without_fractional_seconds.test |   2 +-
 .../t/index_primary_varchar_null_character.test    |   2 +-
 .../mroonga/storage/t/index_primary_year.test      |   2 +-
 .../t/index_range_normal_greater_than_asc.test     |   2 +-
 .../t/index_range_normal_greater_than_desc.test    |   2 +-
 ...dex_range_normal_greater_than_or_equal_asc.test |   2 +-
 ...ex_range_normal_greater_than_or_equal_desc.test |   2 +-
 .../t/index_range_normal_less_than_asc.test        |   2 +-
 .../t/index_range_normal_less_than_desc.test       |   2 +-
 .../index_range_normal_less_than_or_equal_asc.test |   2 +-
 ...index_range_normal_less_than_or_equal_desc.test |   2 +-
 .../t/index_range_primary_greater_than_asc.test    |   2 +-
 .../t/index_range_primary_greater_than_desc.test   |   2 +-
 ...ex_range_primary_greater_than_or_equal_asc.test |   2 +-
 ...x_range_primary_greater_than_or_equal_desc.test |   2 +-
 .../t/index_range_primary_less_than_asc.test       |   2 +-
 .../t/index_range_primary_less_than_desc.test      |   2 +-
 ...index_range_primary_less_than_or_equal_asc.test |   2 +-
 ...ndex_range_primary_less_than_or_equal_desc.test |   2 +-
 .../storage/t/index_read_multiple_bigint.test      |   2 +-
 .../t/index_read_multiple_bigint_unsigned.test     |   2 +-
 .../storage/t/index_read_multiple_double.test      |   2 +-
 .../storage/t/index_read_multiple_float.test       |   2 +-
 .../mroonga/storage/t/index_read_multiple_int.test |   2 +-
 .../t/index_read_multiple_int_unsigned.test        |   2 +-
 .../storage/t/index_read_multiple_mediumint.test   |   2 +-
 .../t/index_read_multiple_mediumint_unsigned.test  |   2 +-
 .../storage/t/index_read_multiple_smallint.test    |   2 +-
 .../t/index_read_multiple_smallint_unsigned.test   |   2 +-
 .../storage/t/index_read_multiple_tinyint.test     |   2 +-
 .../t/index_read_multiple_tinyint_unsigned.test    |   2 +-
 .../storage/t/index_read_multiple_varchar.test     |   2 +-
 .../t/index_read_multiple_varchar_collation.test   |   2 +-
 .../mroonga/storage/t/index_read_normal_int.test   |   2 +-
 .../storage/t/index_read_normal_varchar.test       |   2 +-
 .../mroonga/storage/t/index_read_primary_int.test  |   2 +-
 .../storage/t/index_read_primary_varchar.test      |   2 +-
 .../mroonga/storage/t/index_unique_delete_all.test |   2 +-
 .../t/index_unique_delete_by_primary_key.test      |   2 +-
 .../storage/t/index_unique_insert_after_error.test |   2 +-
 .../t/index_unique_search_after_duplicated.test    |   2 +-
 .../mroonga/storage/t/index_unique_varchar.test    |   2 +-
 .../storage/t/index_update_multiple_column.test    |   2 +-
 .../storage/t/index_update_single_column.test      |   2 +-
 .../storage/t/information_schema_plugins.test      |   2 +-
 ...ormation_schema_tables_auto_increment_none.test |   2 +-
 ...formation_schema_tables_auto_increment_use.test |   2 +-
 .../t/information_schema_tables_data_length.test   |   2 +-
 .../mroonga/storage/t/insert_TODO_SPLIT_ME.test    |   2 +-
 .../mroonga/storage/t/insert_delayed.test          |   2 +-
 ...update_no_primary_key_and_unique_key_twice.test |   2 +-
 ...insert_on_duplicate_key_update_primary_key.test |   2 +-
 .../insert_on_duplicate_key_update_unique_key.test |   2 +-
 .../mroonga/storage/t/insert_virtual_column.test   |   2 +-
 .../mroonga/storage/t/like_unicode_ci.test         |   2 +-
 .../mroonga/storage/t/lock_tables_read.test        |   2 +-
 ...zation_count_skip_after_insert_multithread.test |   2 +-
 ...tion_count_skip_after_insert_single_thread.test |   2 +-
 .../t/optimization_count_skip_disabled.test        |   2 +-
 .../t/optimization_count_skip_index_and.test       |   2 +-
 .../t/optimization_count_skip_index_between.test   |   2 +-
 .../t/optimization_count_skip_index_equal.test     |   2 +-
 ...kip_index_full_text_search_in_boolean_mode.test |   2 +-
 ..._full_text_search_in_natural_language_mode.test |   2 +-
 .../t/optimization_count_skip_index_greater.test   |   2 +-
 ...ptimization_count_skip_index_greater_equal.test |   2 +-
 .../t/optimization_count_skip_index_less.test      |   2 +-
 .../optimization_count_skip_index_less_equal.test  |   2 +-
 .../t/optimization_count_skip_index_not_equal.test |   2 +-
 .../t/optimization_count_skip_index_view.test      |   2 +-
 ...ptimization_count_skip_multiple_conditions.test |   2 +-
 ...ptimization_count_skip_primary_key_between.test |   2 +-
 .../optimization_count_skip_primary_key_equal.test |   2 +-
 ...ptimization_count_skip_primary_key_greater.test |   2 +-
 ...ation_count_skip_primary_key_greater_equal.test |   2 +-
 .../optimization_count_skip_primary_key_less.test  |   2 +-
 ...mization_count_skip_primary_key_less_equal.test |   2 +-
 ...imization_count_skip_primary_key_not_equal.test |   2 +-
 ...ization_order_limit_not_optimized_disabled.test |   2 +-
 ...imit_not_optimized_multiple_match_againsts.test |   2 +-
 ...ization_order_limit_not_optimized_no_limit.test |   2 +-
 .../optimization_order_limit_optimized_cp932.test  |   2 +-
 ...ion_order_limit_optimized_datetime_between.test |   2 +-
 ...rder_limit_optimized_datetime_between_over.test |   2 +-
 ...ation_order_limit_optimized_datetime_equal.test |   2 +-
 ...rder_limit_optimized_datetime_greater_than.test |   2 +-
 ...t_optimized_datetime_greater_than_or_equal.test |   2 +-
 ...n_order_limit_optimized_datetime_less_than.test |   2 +-
 ...imit_optimized_datetime_less_than_or_equal.test |   2 +-
 ...imit_optimized_duplicated_order_by_columns.test |   2 +-
 ...timization_order_limit_optimized_enum_name.test |   2 +-
 ...imization_order_limit_optimized_enum_value.test |   2 +-
 ...ion_order_limit_optimized_have_primary_key.test |   2 +-
 ...mization_order_limit_optimized_int_between.test |   2 +-
 ...ion_order_limit_optimized_int_between_over.test |   2 +-
 ...timization_order_limit_optimized_int_equal.test |   2 +-
 ...ion_order_limit_optimized_int_greater_than.test |   2 +-
 ..._limit_optimized_int_greater_than_or_equal.test |   2 +-
 ...zation_order_limit_optimized_int_less_than.test |   2 +-
 ...der_limit_optimized_int_less_than_or_equal.test |   2 +-
 ...ation_order_limit_optimized_no_primary_key.test |   2 +-
 ...tion_order_limit_optimized_no_where_clause.test |   2 +-
 ...ization_order_limit_optimized_order_by_asc.test |   2 +-
 ...zation_order_limit_optimized_order_by_desc.test |   2 +-
 ...mization_order_limit_optimized_order_by_id.test |   2 +-
 ...der_limit_optimized_order_by_match_against.test |   2 +-
 ...order_limit_optimized_select_match_against.test |   2 +-
 ...ization_order_limit_optimized_time_between.test |   2 +-
 ...on_order_limit_optimized_time_between_over.test |   2 +-
 ...imization_order_limit_optimized_time_equal.test |   2 +-
 ...on_order_limit_optimized_time_greater_than.test |   2 +-
 ...limit_optimized_time_greater_than_or_equal.test |   2 +-
 ...ation_order_limit_optimized_time_less_than.test |   2 +-
 ...er_limit_optimized_time_less_than_or_equal.test |   2 +-
 ...r_limit_optimized_varchar_equal_with_index.test |   2 +-
 ...imit_optimized_varchar_equal_without_index.test |   2 +-
 ...ization_order_limit_optimized_year_between.test |   2 +-
 ...on_order_limit_optimized_year_between_over.test |   2 +-
 ...imization_order_limit_optimized_year_equal.test |   2 +-
 ...on_order_limit_optimized_year_greater_than.test |   2 +-
 ...limit_optimized_year_greater_than_or_equal.test |   2 +-
 ...ation_order_limit_optimized_year_less_than.test |   2 +-
 ...er_limit_optimized_year_less_than_or_equal.test |   2 +-
 .../mroonga/storage/t/partition_insert.test        |   2 +-
 .../mroonga/storage/t/partition_update.test        |   2 +-
 .../storage/t/repair_table_no_index_file.test      |   2 +-
 .../mroonga/storage/t/replace_geometry.test        |   2 +-
 .../mroonga/storage/t/replace_select_varchar.test  |   2 +-
 .../mysql-test/mroonga/storage/t/replace_text.test |   2 +-
 .../mroonga/storage/t/replace_varchar.test         |   2 +-
 .../mroonga/storage/t/replace_vector.test          |   2 +-
 .../mroonga/storage/t/replace_without_key.test     |   2 +-
 .../mysql-test/mroonga/storage/t/select_all.test   |   2 +-
 .../storage/t/select_empty_key_where_equal.test    |   2 +-
 .../t/select_empty_key_where_not_equal.test        |   2 +-
 .../storage/t/select_group_by_with_index.test      |   2 +-
 .../storage/t/select_group_by_without_index.test   |   2 +-
 .../mysql-test/mroonga/storage/t/select_pkey.test  |   2 +-
 .../mroonga/storage/t/select_secondary_key.test    |   2 +-
 .../storage/t/show_create_table_TODO_SPLIT_ME.test |   2 +-
 .../mroonga/storage/t/sub_query_fulltext.test      |   2 +-
 .../mroonga/storage/t/temporary_table.test         |   2 +-
 .../mysql-test/mroonga/storage/t/truncate.test     |   2 +-
 .../mroonga/storage/t/update_binlog_row.test       |   2 +-
 .../mroonga/storage/t/update_fulltext.test         |   2 +-
 .../mroonga/storage/t/update_id_hash_index.test    |   2 +-
 .../storage/t/update_id_unique_hash_index.test     |   2 +-
 .../mysql-test/mroonga/storage/t/update_int.test   |   2 +-
 .../storage/t/update_last_insert_grn_id.test       |   2 +-
 .../mroonga/storage/t/update_virtual_column.test   |   2 +-
 ...ble_boolean_mode_syntax_flags_allow_column.test |   2 +-
 ...oolean_mode_syntax_flags_allow_leading_not.test |   2 +-
 ...ble_boolean_mode_syntax_flags_allow_update.test |   2 +-
 ...ble_boolean_mode_syntax_flags_syntax_query.test |   2 +-
 ...le_boolean_mode_syntax_flags_syntax_script.test |   2 +-
 .../storage/t/variable_database_path_prefix.test   |   2 +-
 .../t/variable_default_parser_new_value.test       |   2 +-
 .../t/variable_default_parser_same_value.test      |   2 +-
 .../t/variable_default_tokenizer_new_value.test    |   2 +-
 .../t/variable_default_tokenizer_same_value.test   |   2 +-
 .../storage/t/variable_dry_write_delete.test       |   2 +-
 .../storage/t/variable_dry_write_insert.test       |   2 +-
 .../storage/t/variable_dry_write_update.test       |   2 +-
 ...ariable_enable_operations_recording_insert.test |   2 +-
 .../storage/t/variable_lock_timeout_disable.test   |   2 +-
 .../storage/t/variable_lock_timeout_invalid.test   |   2 +-
 .../storage/t/variable_lock_timeout_no_retry.test  |   2 +-
 .../storage/t/variable_lock_timeout_valid.test     |   2 +-
 .../storage/t/variable_log_file_new_value.test     |   2 +-
 .../t/variable_log_file_nonexistent_path.test      |   2 +-
 .../storage/t/variable_log_file_same_value.test    |   2 +-
 .../t/variable_log_level_TODO_SPLIT_ME.test        |   2 +-
 ...variable_match_escalation_threshold_global.test |   2 +-
 ...ariable_match_escalation_threshold_session.test |   2 +-
 ...variable_max_n_records_for_estimate_global.test |   2 +-
 ...rds_for_estimate_mysql_5_7_or_later_global.test |   2 +-
 ...mate_mysql_5_7_or_later_not_found_in_limit.test |   2 +-
 ...ds_for_estimate_mysql_5_7_or_later_session.test |   2 +-
 ..._n_records_for_estimate_not_found_in_limit.test |   2 +-
 ...ariable_max_n_records_for_estimate_session.test |   2 +-
 ...riable_query_log_file_disabled_empty_value.test |   2 +-
 ...ariable_query_log_file_disabled_null_value.test |   2 +-
 ...ariable_query_log_file_enabled_empty_value.test |   2 +-
 ...variable_query_log_file_enabled_null_value.test |   2 +-
 .../t/variable_query_log_file_new_value.test       |   2 +-
 .../t/variable_query_log_file_same_value.test      |   2 +-
 .../t/variable_vector_column_delimiter.test        |   2 +-
 .../mroonga/storage/t/variable_version.test        |   2 +-
 .../mroonga/wrapper/t/alter_table_add_column.test  |   2 +-
 .../t/alter_table_add_column_multibyte_cp932.test  |   2 +-
 .../t/alter_table_add_column_multibyte_utf8.test   |   2 +-
 .../t/alter_table_change_column_comment.test       |   2 +-
 .../wrapper/t/alter_table_change_engine.test       |   2 +-
 .../t/alter_table_comment_change_engine.test       |   2 +-
 .../alter_table_disable_keys_create_fulltext.test  |   2 +-
 .../t/alter_table_disable_keys_fulltext.test       |   2 +-
 .../alter_table_disable_keys_multiple_column.test  |   2 +-
 .../wrapper/t/alter_table_disable_keys_normal.test |   2 +-
 .../t/alter_table_disable_keys_primary.test        |   2 +-
 .../t/alter_table_disable_keys_updating.test       |   2 +-
 .../mroonga/wrapper/t/alter_table_drop_column.test |   2 +-
 .../t/alter_table_enable_keys_fulltext.test        |   2 +-
 .../t/alter_table_enable_keys_lock_tables.test     |   2 +-
 .../t/alter_table_enable_keys_multiple_column.test |   2 +-
 .../wrapper/t/alter_table_enable_keys_normal.test  |   2 +-
 .../wrapper/t/alter_table_enable_keys_primary.test |   2 +-
 .../mroonga/wrapper/t/alter_table_fulltext.test    |   2 +-
 .../wrapper/t/alter_table_rename_table.test        |   2 +-
 .../mroonga/wrapper/t/alter_table_spatial.test     |   2 +-
 .../mroonga/wrapper/t/auto_increment_text.test     |   2 +-
 .../mroonga/wrapper/t/binlog_TODO_SPLIT_ME.test    |   2 +-
 .../mroonga/wrapper/t/check_table_for_upgrade.test |   2 +-
 .../t/column_comment_index_not_for_mroonga.test    |   2 +-
 .../t/column_generated_stored_add_column.test      |   2 +-
 .../wrapper/t/column_generated_stored_delete.test  |   2 +-
 .../t/column_generated_stored_drop_column.test     |   2 +-
 .../wrapper/t/column_generated_stored_insert.test  |   2 +-
 .../wrapper/t/column_generated_stored_reindex.test |   2 +-
 .../wrapper/t/column_generated_stored_update.test  |   2 +-
 .../t/column_generated_virtual_add_column.test     |   2 +-
 ...olumn_generated_virtual_add_fulltext_index.test |   2 +-
 .../t/column_generated_virtual_add_index.test      |   2 +-
 .../wrapper/t/column_generated_virtual_delete.test |   2 +-
 .../t/column_generated_virtual_drop_column.test    |   2 +-
 .../wrapper/t/column_generated_virtual_insert.test |   2 +-
 .../wrapper/t/column_generated_virtual_update.test |   2 +-
 .../mroonga/wrapper/t/column_multibyte_cp932.test  |   2 +-
 .../mroonga/wrapper/t/column_multibyte_utf8.test   |   2 +-
 .../mroonga/wrapper/t/column_normal_comment.test   |   2 +-
 .../mysql-test/mroonga/wrapper/t/count_star.test   |   2 +-
 .../count_star_mysql_5_7_or_later_with_index.test  |   2 +-
 .../mroonga/wrapper/t/count_star_with_index.test   |   2 +-
 .../wrapper/t/create_table_TODO_SPLIT_ME.test      |   2 +-
 .../wrapper/t/create_table_comment_combined.test   |   2 +-
 .../wrapper/t/create_table_flags_comment.test      |   2 +-
 .../mroonga/wrapper/t/create_table_flags_none.test |   2 +-
 .../wrapper/t/create_table_flags_parameter.test    |   2 +-
 .../wrapper/t/create_table_index_flags_none.test   |   2 +-
 ..._index_flags_with_position_and_with_weight.test |   2 +-
 .../wrapper/t/create_table_normalizer_comment.test |   2 +-
 ...create_table_normalizer_fulltext_index_bin.test |   2 +-
 .../t/create_table_normalizer_parameter.test       |   2 +-
 .../wrapper/t/create_table_parser_comment.test     |   2 +-
 ...token_filters_index_multiple_token_filters.test |   2 +-
 ...table_token_filters_index_one_token_filter.test |   2 +-
 ...create_table_token_filters_index_parameter.test |   2 +-
 .../wrapper/t/create_table_tokenizer_comment.test  |   2 +-
 .../t/create_table_tokenizer_parameter.test        |   2 +-
 .../mroonga/wrapper/t/delete_TODO_SPLIT_ME.test    |   2 +-
 .../mysql-test/mroonga/wrapper/t/delete_all.test   |   2 +-
 .../wrapper/t/drop_table_new_connection.test       |   2 +-
 .../t/fulltext_boolean_mode_leading_not.test       |   2 +-
 ...lltext_boolean_mode_multiple_match_against.test |   2 +-
 ..._pragma_default_operator_minus_no_operator.test |   2 +-
 ...mode_pragma_default_operator_minus_with_or.test |   2 +-
 ...de_pragma_default_operator_minus_with_plus.test |   2 +-
 ...ode_pragma_default_operator_or_no_operator.test |   2 +-
 ...mode_pragma_default_operator_or_with_minus.test |   2 +-
 ..._mode_pragma_default_operator_or_with_plus.test |   2 +-
 ...e_pragma_default_operator_plus_no_operator.test |   2 +-
 ...de_pragma_default_operator_plus_with_minus.test |   2 +-
 ..._mode_pragma_default_operator_plus_with_or.test |   2 +-
 ...ltext_boolean_mode_pragma_weight_full_spec.test |   2 +-
 ...ltext_boolean_mode_pragma_weight_no_weight.test |   2 +-
 ...xt_boolean_mode_pragma_weight_omit_section.test |   2 +-
 .../mroonga/wrapper/t/fulltext_charset_ascii.test  |   2 +-
 .../mroonga/wrapper/t/fulltext_charset_cp932.test  |   2 +-
 .../wrapper/t/fulltext_charset_eucjpms.test        |   2 +-
 .../wrapper/t/fulltext_charset_japanese.test       |   2 +-
 .../mroonga/wrapper/t/fulltext_index_recreate.test |   2 +-
 .../mroonga/wrapper/t/fulltext_insert_select.test  |   2 +-
 .../mroonga/wrapper/t/fulltext_insert_values.test  |   2 +-
 .../mroonga/wrapper/t/fulltext_many_records.test   |   2 +-
 ...d_and_not_matched_have_where_matched_order.test |   2 +-
 ...atched_and_not_matched_have_where_no_order.test |   2 +-
 ...atched_and_not_matched_no_where_both_order.test |   2 +-
 .../t/fulltext_multiple_column_index_delete.test   |   2 +-
 .../t/fulltext_multiple_column_index_insert.test   |   2 +-
 .../t/fulltext_multiple_column_index_recreate.test |   2 +-
 .../t/fulltext_multiple_column_index_update.test   |   2 +-
 .../mroonga/wrapper/t/fulltext_multiple_index.test |   2 +-
 .../mroonga/wrapper/t/fulltext_myisam.test         |   2 +-
 .../wrapper/t/fulltext_not_match_against.test      |   2 +-
 .../wrapper/t/fulltext_order_TODO_SPLIT_ME.test    |   2 +-
 .../wrapper/t/fulltext_order_transaction.test      |   2 +-
 .../t/function_last_insert_id_reference.test       |   2 +-
 .../wrapper/t/function_last_insert_id_set.test     |   2 +-
 .../mroonga/wrapper/t/geometry_contains.test       |   2 +-
 .../mroonga/wrapper/t/geometry_delete.test         |   2 +-
 .../mroonga/wrapper/t/geometry_update.test         |   2 +-
 .../wrapper/t/index_force_index_not_used.test      |   2 +-
 .../mroonga/wrapper/t/insert_TODO_SPLIT_ME.test    |   2 +-
 .../mysql-test/mroonga/wrapper/t/insert_bulk.test  |   2 +-
 ..._update_multiple_column_primary_key_myisam.test |   2 +-
 ...update_multiple_column_unique_index_myisam.test |   2 +-
 .../wrapper/t/multi_range_read_disk_sweep.test     |   2 +-
 ...i_range_read_mysql_5_7_or_later_disk_sweep.test |   2 +-
 .../t/optimization_order_limit_TODO_SPLIT_ME.test  |   2 +-
 .../t/optimization_order_limit_no_direction.test   |   2 +-
 .../optimization_order_limit_no_where_clause.test  |   2 +-
 ...imization_order_limit_order_by_primary_key.test |   2 +-
 .../mroonga/wrapper/t/performance_schema.test      |   2 +-
 .../mroonga/wrapper/t/repair_table_no_files.test   |   2 +-
 .../wrapper/t/repair_table_no_index_file.test      |   2 +-
 .../mroonga/wrapper/t/temporary_table.test         |   2 +-
 .../mroonga/wrapper/t/transaction_query_cache.test |   2 +-
 .../t/transaction_rollback_delete_delete.test      |   2 +-
 .../t/transaction_rollback_delete_update.test      |   2 +-
 .../mysql-test/mroonga/wrapper/t/truncate.test     |   2 +-
 .../mroonga/wrapper/t/update_fulltext.test         |   2 +-
 .../mysql-test/mroonga/wrapper/t/update_int.test   |   2 +-
 .../wrapper/t/variable_dry_write_delete.test       |   2 +-
 .../wrapper/t/variable_dry_write_insert.test       |   2 +-
 .../wrapper/t/variable_dry_write_update.test       |   2 +-
 ...variable_match_escalation_threshold_global.test |   2 +-
 ...ariable_match_escalation_threshold_session.test |   2 +-
 storage/mroonga/packages/ubuntu/upload.rb          |   2 +-
 storage/mroonga/test/run-sql-test.sh               |   2 +-
 storage/mroonga/test/unit/test_mrn_path_mapper.cpp |   2 +-
 storage/mroonga/tools/travis/before_script.sh      |   2 +-
 storage/mroonga/tools/travis/install.sh            |   2 +-
 storage/mroonga/tools/travis/script.sh             |   2 +-
 storage/mroonga/udf/mrn_udf_command.cpp            |   2 +-
 storage/mroonga/udf/mrn_udf_escape.cpp             |   2 +-
 storage/mroonga/udf/mrn_udf_highlight_html.cpp     |   2 +-
 storage/mroonga/udf/mrn_udf_last_insert_grn_id.cpp |   2 +-
 storage/mroonga/udf/mrn_udf_normalize.cpp          |   2 +-
 storage/mroonga/udf/mrn_udf_query_expand.cpp       |   2 +-
 storage/mroonga/udf/mrn_udf_snippet.cpp            |   2 +-
 storage/mroonga/udf/mrn_udf_snippet_html.cpp       |   2 +-
 storage/mroonga/vendor/groonga/CMakeLists.txt      |   2 +-
 storage/mroonga/vendor/groonga/COPYING             |   4 +-
 .../groonga/benchmark/bench-between-sequential.c   |   2 +-
 .../mroonga/vendor/groonga/benchmark/bench-cache.c |   2 +-
 .../vendor/groonga/benchmark/bench-ctx-create.c    |   2 +-
 .../vendor/groonga/benchmark/bench-geo-distance.c  |   2 +-
 .../vendor/groonga/benchmark/bench-geo-select.c    |   2 +-
 .../mroonga/vendor/groonga/benchmark/bench-nfkc.c  |   2 +-
 .../groonga/benchmark/bench-query-optimizer.c      |   2 +-
 .../vendor/groonga/benchmark/bench-range-select.c  |   2 +-
 .../vendor/groonga/benchmark/bench-result-set.c    |   2 +-
 .../vendor/groonga/benchmark/bench-table-factory.c |   2 +-
 .../vendor/groonga/benchmark/lib/bench-reporter.c  |   2 +-
 .../vendor/groonga/benchmark/lib/bench-reporter.h  |   2 +-
 .../vendor/groonga/benchmark/lib/bench-utils.c     |   2 +-
 .../vendor/groonga/benchmark/lib/bench-utils.h     |   2 +-
 .../vendor/groonga/benchmark/lib/benchmark.c       |   2 +-
 .../vendor/groonga/benchmark/lib/benchmark.h       |   2 +-
 .../vendor/groonga/bindings/python/ql/groongaql.c  |   2 +-
 .../groonga/build/cmake_modules/ReadFileList.cmake |   2 +-
 .../mroonga/vendor/groonga/include/CMakeLists.txt  |   2 +-
 storage/mroonga/vendor/groonga/include/groonga.h   |   2 +-
 storage/mroonga/vendor/groonga/include/groonga.hpp |   2 +-
 .../vendor/groonga/include/groonga/accessor.h      |   2 +-
 .../mroonga/vendor/groonga/include/groonga/array.h |   2 +-
 .../mroonga/vendor/groonga/include/groonga/arrow.h |   2 +-
 .../vendor/groonga/include/groonga/arrow.hpp       |   2 +-
 .../mroonga/vendor/groonga/include/groonga/cache.h |   2 +-
 .../vendor/groonga/include/groonga/column.h        |   2 +-
 .../vendor/groonga/include/groonga/command.h       |   2 +-
 .../vendor/groonga/include/groonga/config.h        |   2 +-
 .../mroonga/vendor/groonga/include/groonga/dat.h   |   2 +-
 .../mroonga/vendor/groonga/include/groonga/db.h    |   2 +-
 .../mroonga/vendor/groonga/include/groonga/dump.h  |   2 +-
 .../mroonga/vendor/groonga/include/groonga/error.h |   2 +-
 .../mroonga/vendor/groonga/include/groonga/expr.h  |   2 +-
 .../vendor/groonga/include/groonga/file_reader.h   |   2 +-
 .../mroonga/vendor/groonga/include/groonga/geo.h   |   2 +-
 .../vendor/groonga/include/groonga/groonga.h       |   2 +-
 .../mroonga/vendor/groonga/include/groonga/hash.h  |   2 +-
 .../mroonga/vendor/groonga/include/groonga/id.h    |   2 +-
 .../mroonga/vendor/groonga/include/groonga/ii.h    |   2 +-
 .../mroonga/vendor/groonga/include/groonga/nfkc.h  |   2 +-
 .../vendor/groonga/include/groonga/normalizer.h    |   2 +-
 .../mroonga/vendor/groonga/include/groonga/obj.h   |   2 +-
 .../vendor/groonga/include/groonga/operator.h      |   2 +-
 .../vendor/groonga/include/groonga/output.h        |   2 +-
 .../mroonga/vendor/groonga/include/groonga/pat.h   |   2 +-
 .../vendor/groonga/include/groonga/plugin.h        |   2 +-
 .../vendor/groonga/include/groonga/portability.h   |   2 +-
 .../groonga/include/groonga/request_canceler.h     |   2 +-
 .../vendor/groonga/include/groonga/request_timer.h |   2 +-
 .../vendor/groonga/include/groonga/scorer.h        |   2 +-
 .../mroonga/vendor/groonga/include/groonga/table.h |   2 +-
 .../vendor/groonga/include/groonga/thread.h        |   2 +-
 .../mroonga/vendor/groonga/include/groonga/time.h  |   2 +-
 .../mroonga/vendor/groonga/include/groonga/token.h |   2 +-
 .../vendor/groonga/include/groonga/token_filter.h  |   2 +-
 .../vendor/groonga/include/groonga/tokenizer.h     |   2 +-
 .../mroonga/vendor/groonga/include/groonga/type.h  |   2 +-
 .../mroonga/vendor/groonga/include/groonga/util.h  |   2 +-
 .../groonga/include/groonga/window_function.h      |   2 +-
 .../vendor/groonga/include/groonga/windows.h       |   2 +-
 .../groonga/include/groonga/windows_event_logger.h |   2 +-
 storage/mroonga/vendor/groonga/lib/CMakeLists.txt  |   2 +-
 storage/mroonga/vendor/groonga/lib/alloc.c         |   2 +-
 storage/mroonga/vendor/groonga/lib/arrow.cpp       |   2 +-
 storage/mroonga/vendor/groonga/lib/cache.c         |   2 +-
 storage/mroonga/vendor/groonga/lib/column.c        |   2 +-
 storage/mroonga/vendor/groonga/lib/com.c           |   2 +-
 storage/mroonga/vendor/groonga/lib/command.c       |   2 +-
 storage/mroonga/vendor/groonga/lib/config.c        |   2 +-
 storage/mroonga/vendor/groonga/lib/ctx.c           |   2 +-
 storage/mroonga/vendor/groonga/lib/ctx_impl_mrb.c  |   2 +-
 storage/mroonga/vendor/groonga/lib/dat.cpp         |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/array.hpp   |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/base.hpp    |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/block.hpp   |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/check.hpp   |   2 +-
 .../vendor/groonga/lib/dat/cursor-factory.cpp      |   2 +-
 .../vendor/groonga/lib/dat/cursor-factory.hpp      |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/cursor.hpp  |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/dat.hpp     |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/entry.hpp   |   2 +-
 .../mroonga/vendor/groonga/lib/dat/file-impl.cpp   |   2 +-
 .../mroonga/vendor/groonga/lib/dat/file-impl.hpp   |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/file.cpp    |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/file.hpp    |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/header.hpp  |   2 +-
 .../mroonga/vendor/groonga/lib/dat/id-cursor.cpp   |   2 +-
 .../mroonga/vendor/groonga/lib/dat/id-cursor.hpp   |   2 +-
 .../mroonga/vendor/groonga/lib/dat/key-cursor.cpp  |   2 +-
 .../mroonga/vendor/groonga/lib/dat/key-cursor.hpp  |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/key.hpp     |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/node.hpp    |   2 +-
 .../vendor/groonga/lib/dat/predictive-cursor.cpp   |   2 +-
 .../vendor/groonga/lib/dat/predictive-cursor.hpp   |   2 +-
 .../vendor/groonga/lib/dat/prefix-cursor.cpp       |   2 +-
 .../vendor/groonga/lib/dat/prefix-cursor.hpp       |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/string.hpp  |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/trie.cpp    |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/trie.hpp    |   2 +-
 storage/mroonga/vendor/groonga/lib/dat/vector.hpp  |   2 +-
 storage/mroonga/vendor/groonga/lib/db.c            |   2 +-
 storage/mroonga/vendor/groonga/lib/dump.c          |   2 +-
 storage/mroonga/vendor/groonga/lib/error.c         |   2 +-
 storage/mroonga/vendor/groonga/lib/expr.c          |   2 +-
 storage/mroonga/vendor/groonga/lib/expr_code.c     |   2 +-
 storage/mroonga/vendor/groonga/lib/expr_executor.c |   2 +-
 storage/mroonga/vendor/groonga/lib/file_lock.c     |   2 +-
 storage/mroonga/vendor/groonga/lib/file_reader.c   |   2 +-
 storage/mroonga/vendor/groonga/lib/geo.c           |   2 +-
 storage/mroonga/vendor/groonga/lib/grn.h           |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_alloc.h     |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_cache.h     |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_com.h       |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_config.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_ctx.h       |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_ctx_impl.h  |   2 +-
 .../mroonga/vendor/groonga/lib/grn_ctx_impl_mrb.h  |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_dat.h       |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_db.h        |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_error.h     |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_expr.h      |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_expr_code.h |   2 +-
 .../mroonga/vendor/groonga/lib/grn_expr_executor.h |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_file_lock.h |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_geo.h       |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_hash.h      |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_ii.h        |   2 +-
 .../mroonga/vendor/groonga/lib/grn_index_column.h  |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_io.h        |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_load.h      |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_logger.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_mrb.h       |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_msgpack.h   |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_nfkc.h      |   2 +-
 .../mroonga/vendor/groonga/lib/grn_normalizer.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_obj.h       |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_output.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_pat.h       |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_plugin.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_proc.h      |   2 +-
 .../mroonga/vendor/groonga/lib/grn_raw_string.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_report.h    |   2 +-
 .../vendor/groonga/lib/grn_request_canceler.h      |   2 +-
 .../mroonga/vendor/groonga/lib/grn_request_timer.h |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_rset.h      |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_scanner.h   |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_scorer.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_scorers.h   |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_snip.h      |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_store.h     |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_str.h       |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_string.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_time.h      |   2 +-
 .../mroonga/vendor/groonga/lib/grn_token_cursor.h  |   2 +-
 .../mroonga/vendor/groonga/lib/grn_tokenizers.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_ts.h        |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_util.h      |   2 +-
 .../vendor/groonga/lib/grn_window_function.h       |   2 +-
 .../vendor/groonga/lib/grn_window_functions.h      |   2 +-
 storage/mroonga/vendor/groonga/lib/grn_windows.h   |   2 +-
 storage/mroonga/vendor/groonga/lib/hash.c          |   2 +-
 storage/mroonga/vendor/groonga/lib/icudump.c       |   2 +-
 storage/mroonga/vendor/groonga/lib/id.c            |   2 +-
 storage/mroonga/vendor/groonga/lib/ii.c            |   2 +-
 storage/mroonga/vendor/groonga/lib/index_column.c  |   2 +-
 storage/mroonga/vendor/groonga/lib/io.c            |   2 +-
 storage/mroonga/vendor/groonga/lib/load.c          |   2 +-
 storage/mroonga/vendor/groonga/lib/logger.c        |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb.c           |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_accessor.c  |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_accessor.h  |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_array.c |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_array.h |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.c  |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_bulk.h  |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_cache.c |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_cache.h |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_column.c    |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_column.h    |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_command.c   |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_command.h   |   2 +-
 .../vendor/groonga/lib/mrb/mrb_command_input.c     |   2 +-
 .../vendor/groonga/lib/mrb/mrb_command_input.h     |   2 +-
 .../vendor/groonga/lib/mrb/mrb_command_version.c   |   2 +-
 .../vendor/groonga/lib/mrb/mrb_command_version.h   |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_config.c    |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_config.h    |   2 +-
 .../vendor/groonga/lib/mrb/mrb_content_type.c      |   2 +-
 .../vendor/groonga/lib/mrb/mrb_content_type.h      |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_converter.c |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_converter.h |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.c   |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_ctx.h   |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_database.c  |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_database.h  |   2 +-
 .../vendor/groonga/lib/mrb/mrb_double_array_trie.c |   2 +-
 .../vendor/groonga/lib/mrb/mrb_double_array_trie.h |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_error.c |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_error.h |   2 +-
 .../vendor/groonga/lib/mrb/mrb_eval_context.c      |   2 +-
 .../vendor/groonga/lib/mrb/mrb_eval_context.h      |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.c  |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_expr.h  |   2 +-
 .../vendor/groonga/lib/mrb/mrb_fixed_size_column.c |   2 +-
 .../vendor/groonga/lib/mrb/mrb_fixed_size_column.h |   2 +-
 .../vendor/groonga/lib/mrb/mrb_hash_table.c        |   2 +-
 .../vendor/groonga/lib/mrb/mrb_hash_table.h        |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_id.c    |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_id.h    |   2 +-
 .../vendor/groonga/lib/mrb/mrb_index_column.c      |   2 +-
 .../vendor/groonga/lib/mrb/mrb_index_column.h      |   2 +-
 .../vendor/groonga/lib/mrb/mrb_index_cursor.c      |   2 +-
 .../vendor/groonga/lib/mrb/mrb_index_cursor.h      |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_indexable.c |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_indexable.h |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_logger.c    |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_logger.h    |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_object.c    |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_object.h    |   2 +-
 .../vendor/groonga/lib/mrb/mrb_object_flags.c      |   2 +-
 .../vendor/groonga/lib/mrb/mrb_object_flags.h      |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_operator.c  |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_operator.h  |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_options.c   |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_options.h   |   2 +-
 .../vendor/groonga/lib/mrb/mrb_patricia_trie.c     |   2 +-
 .../vendor/groonga/lib/mrb/mrb_patricia_trie.h     |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_pointer.c   |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_pointer.h   |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_procedure.c |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_procedure.h |   2 +-
 .../vendor/groonga/lib/mrb/mrb_query_logger.c      |   2 +-
 .../vendor/groonga/lib/mrb/mrb_query_logger.h      |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_record.c    |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_record.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_table.c |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_table.h |   2 +-
 .../vendor/groonga/lib/mrb/mrb_table_cursor.c      |   2 +-
 .../vendor/groonga/lib/mrb/mrb_table_cursor.h      |   2 +-
 .../groonga/lib/mrb/mrb_table_cursor_flags.c       |   2 +-
 .../groonga/lib/mrb/mrb_table_cursor_flags.h       |   2 +-
 .../vendor/groonga/lib/mrb/mrb_table_group_flags.c |   2 +-
 .../vendor/groonga/lib/mrb/mrb_table_group_flags.h |   2 +-
 .../groonga/lib/mrb/mrb_table_group_result.c       |   2 +-
 .../groonga/lib/mrb/mrb_table_group_result.h       |   2 +-
 .../vendor/groonga/lib/mrb/mrb_table_sort_flags.c  |   2 +-
 .../vendor/groonga/lib/mrb/mrb_table_sort_flags.h  |   2 +-
 .../vendor/groonga/lib/mrb/mrb_table_sort_key.c    |   2 +-
 .../vendor/groonga/lib/mrb/mrb_table_sort_key.h    |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_thread.c    |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_thread.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_type.c  |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_type.h  |   2 +-
 .../groonga/lib/mrb/mrb_variable_size_column.c     |   2 +-
 .../groonga/lib/mrb/mrb_variable_size_column.h     |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_void.c  |   2 +-
 storage/mroonga/vendor/groonga/lib/mrb/mrb_void.h  |   2 +-
 .../vendor/groonga/lib/mrb/mrb_window_definition.c |   2 +-
 .../vendor/groonga/lib/mrb/mrb_window_definition.h |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_writer.c    |   2 +-
 .../mroonga/vendor/groonga/lib/mrb/mrb_writer.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/nfkc.c          |   2 +-
 storage/mroonga/vendor/groonga/lib/nfkc.rb         |   4 +-
 storage/mroonga/vendor/groonga/lib/nfkc50.c        |   2 +-
 storage/mroonga/vendor/groonga/lib/normalizer.c    |   2 +-
 storage/mroonga/vendor/groonga/lib/obj.c           |   2 +-
 storage/mroonga/vendor/groonga/lib/operator.c      |   2 +-
 storage/mroonga/vendor/groonga/lib/output.c        |   2 +-
 storage/mroonga/vendor/groonga/lib/pat.c           |   2 +-
 storage/mroonga/vendor/groonga/lib/plugin.c        |   2 +-
 storage/mroonga/vendor/groonga/lib/proc.c          |   2 +-
 .../mroonga/vendor/groonga/lib/proc/proc_column.c  |   2 +-
 .../mroonga/vendor/groonga/lib/proc/proc_config.c  |   2 +-
 .../mroonga/vendor/groonga/lib/proc/proc_dump.c    |   2 +-
 .../vendor/groonga/lib/proc/proc_fuzzy_search.c    |   2 +-
 .../vendor/groonga/lib/proc/proc_highlight.c       |   2 +-
 .../vendor/groonga/lib/proc/proc_in_records.c      |   2 +-
 .../mroonga/vendor/groonga/lib/proc/proc_lock.c    |   2 +-
 .../mroonga/vendor/groonga/lib/proc/proc_object.c  |   2 +-
 .../vendor/groonga/lib/proc/proc_object_inspect.c  |   2 +-
 .../vendor/groonga/lib/proc/proc_object_list.c     |   2 +-
 .../mroonga/vendor/groonga/lib/proc/proc_query.c   |   2 +-
 .../vendor/groonga/lib/proc/proc_query_log_flags.c |   2 +-
 .../mroonga/vendor/groonga/lib/proc/proc_schema.c  |   2 +-
 .../mroonga/vendor/groonga/lib/proc/proc_select.c  |   2 +-
 .../mroonga/vendor/groonga/lib/proc/proc_snippet.c |   2 +-
 .../mroonga/vendor/groonga/lib/proc/proc_table.c   |   2 +-
 .../vendor/groonga/lib/proc/proc_tokenize.c        |   2 +-
 storage/mroonga/vendor/groonga/lib/raw_string.c    |   2 +-
 storage/mroonga/vendor/groonga/lib/report.c        |   2 +-
 .../mroonga/vendor/groonga/lib/request_canceler.c  |   2 +-
 storage/mroonga/vendor/groonga/lib/request_timer.c |   2 +-
 storage/mroonga/vendor/groonga/lib/rset.c          |   2 +-
 storage/mroonga/vendor/groonga/lib/scanner.c       |   2 +-
 storage/mroonga/vendor/groonga/lib/scorer.c        |   2 +-
 storage/mroonga/vendor/groonga/lib/scorers.c       |   2 +-
 storage/mroonga/vendor/groonga/lib/snip.c          |   2 +-
 storage/mroonga/vendor/groonga/lib/store.c         |   2 +-
 storage/mroonga/vendor/groonga/lib/str.c           |   2 +-
 storage/mroonga/vendor/groonga/lib/string.c        |   2 +-
 storage/mroonga/vendor/groonga/lib/table.c         |   2 +-
 storage/mroonga/vendor/groonga/lib/thread.c        |   2 +-
 storage/mroonga/vendor/groonga/lib/time.c          |   2 +-
 storage/mroonga/vendor/groonga/lib/token_cursor.c  |   2 +-
 storage/mroonga/vendor/groonga/lib/token_filter.c  |   2 +-
 storage/mroonga/vendor/groonga/lib/tokenizer.c     |   2 +-
 storage/mroonga/vendor/groonga/lib/tokenizers.c    |   2 +-
 storage/mroonga/vendor/groonga/lib/ts.c            |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_buf.c     |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_buf.h     |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_cursor.c  |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_cursor.h  |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_expr.c    |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_expr.h    |   2 +-
 .../vendor/groonga/lib/ts/ts_expr_builder.c        |   2 +-
 .../vendor/groonga/lib/ts/ts_expr_builder.h        |   2 +-
 .../mroonga/vendor/groonga/lib/ts/ts_expr_node.c   |   2 +-
 .../mroonga/vendor/groonga/lib/ts/ts_expr_node.h   |   2 +-
 .../mroonga/vendor/groonga/lib/ts/ts_expr_parser.c |   2 +-
 .../mroonga/vendor/groonga/lib/ts/ts_expr_parser.h |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_log.h     |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_op.c      |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_op.h      |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_plan.c    |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_plan.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_sorter.c  |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_sorter.h  |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_str.c     |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_str.h     |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_types.h   |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_util.c    |   2 +-
 storage/mroonga/vendor/groonga/lib/ts/ts_util.h    |   2 +-
 storage/mroonga/vendor/groonga/lib/type.c          |   2 +-
 storage/mroonga/vendor/groonga/lib/util.c          |   2 +-
 .../mroonga/vendor/groonga/lib/window_function.c   |   2 +-
 .../mroonga/vendor/groonga/lib/window_functions.c  |   2 +-
 storage/mroonga/vendor/groonga/lib/windows.c       |   2 +-
 .../vendor/groonga/lib/windows_event_logger.c      |   2 +-
 .../mroonga/vendor/groonga/plugins/CMakeLists.txt  |   2 +-
 .../plugins/expression_rewriters/CMakeLists.txt    |   2 +-
 .../groonga/plugins/functions/CMakeLists.txt       |   2 +-
 .../groonga/plugins/functions/index_column.c       |   2 +-
 .../vendor/groonga/plugins/functions/math.c        |   2 +-
 .../vendor/groonga/plugins/functions/number.c      |   2 +-
 .../vendor/groonga/plugins/functions/string.c      |   2 +-
 .../vendor/groonga/plugins/functions/time.c        |   2 +-
 .../vendor/groonga/plugins/functions/vector.c      |   2 +-
 .../groonga/plugins/query_expanders/CMakeLists.txt |   2 +-
 .../vendor/groonga/plugins/query_expanders/tsv.c   |   2 +-
 .../vendor/groonga/plugins/ruby/CMakeLists.txt     |   2 +-
 .../vendor/groonga/plugins/sharding/CMakeLists.txt |   2 +-
 .../vendor/groonga/plugins/suggest/CMakeLists.txt  |   2 +-
 .../vendor/groonga/plugins/suggest/suggest.c       |   2 +-
 .../groonga/plugins/token_filters/CMakeLists.txt   |   2 +-
 .../vendor/groonga/plugins/token_filters/stem.c    |   2 +-
 .../groonga/plugins/token_filters/stop_word.c      |   2 +-
 .../groonga/plugins/tokenizers/CMakeLists.txt      |   2 +-
 .../vendor/groonga/plugins/tokenizers/kytea.cpp    |   2 +-
 .../vendor/groonga/plugins/tokenizers/mecab.c      |   2 +-
 storage/mroonga/vendor/groonga/src/CMakeLists.txt  |   2 +-
 storage/mroonga/vendor/groonga/src/grndb.c         |   2 +-
 storage/mroonga/vendor/groonga/src/grnslap.c       |   2 +-
 storage/mroonga/vendor/groonga/src/groonga.c       |   2 +-
 .../mroonga/vendor/groonga/src/groonga_benchmark.c |   2 +-
 storage/mroonga/vendor/groonga/src/groonga_mruby.c |   2 +-
 .../httpd/nginx-module/ngx_http_groonga_module.c   |   2 +-
 .../vendor/groonga/src/suggest/CMakeLists.txt      |   2 +-
 .../src/suggest/groonga_suggest_create_dataset.c   |   2 +-
 .../groonga/src/suggest/groonga_suggest_httpd.c    |   2 +-
 .../groonga/src/suggest/groonga_suggest_learner.c  |   2 +-
 storage/mroonga/vendor/groonga/src/suggest/util.c  |   2 +-
 storage/mroonga/vendor/groonga/src/suggest/util.h  |   2 +-
 .../vendor/groonga/src/suggest/zmq_compatible.h    |   2 +-
 .../groonga/tools/groonga-object-list-checker.rb   |   2 +-
 .../groonga/tools/groonga-suggest-httpd-client.rb  |   2 +-
 .../mroonga/vendor/groonga/vendor/CMakeLists.txt   |   2 +-
 .../vendor/groonga/vendor/lz4/CMakeLists.txt       |   2 +-
 .../vendor/groonga/vendor/mecab/CMakeLists.txt     |   2 +-
 .../groonga/vendor/message_pack/CMakeLists.txt     |   2 +-
 .../vendor/groonga/vendor/mruby/CMakeLists.txt     |   2 +-
 .../vendor/groonga/vendor/onigmo/CMakeLists.txt    |   2 +-
 .../vendor/groonga/vendor/plugins/CMakeLists.txt   |   2 +-
 .../groonga-normalizer-mysql/CMakeLists.txt        |   2 +-
 .../plugins/groonga-normalizer-mysql/Makefile.am   |   2 +-
 .../plugins/groonga-normalizer-mysql/autogen.sh    |   2 +-
 .../groonga-normalizer-mysql/build/Makefile.am     |   2 +-
 .../build/cmake_modules/Makefile.am                |   2 +-
 .../build/cmake_modules/ReadFileList.cmake         |   2 +-
 .../plugins/groonga-normalizer-mysql/configure.ac  |   2 +-
 .../groonga-normalizer-mysql/data/travis/setup.sh  |   2 +-
 .../groonga-normalizer-mysql/doc/Makefile.am       |   2 +-
 .../groonga-normalizer-mysql/doc/text/Makefile.am  |   2 +-
 .../groonga-normalizer-mysql/doc/text/lgpl-2.0.txt |   4 +-
 .../normalizers/CMakeLists.txt                     |   2 +-
 .../normalizers/Makefile.am                        |   2 +-
 .../groonga-normalizer-mysql/normalizers/mysql.c   |   2 +-
 .../normalizers/mysql_general_ci_table.h           |   4 +-
 ...ept_kana_ci_kana_with_voiced_sound_mark_table.h |   4 +-
 .../normalizers/mysql_unicode_520_ci_table.h       |   4 +-
 ...ept_kana_ci_kana_with_voiced_sound_mark_table.h |   4 +-
 .../normalizers/mysql_unicode_ci_table.h           |   4 +-
 .../packages/debian/copyright                      |   4 +-
 .../tool/dump_difference_uca.rb                    |   2 +-
 .../tool/dump_difference_utf8.rb                   |   2 +-
 .../tool/generate_uca_table.rb                     |   6 +-
 .../tool/generate_utf8_table.rb                    |   6 +-
 .../groonga-normalizer-mysql/tool/parser.rb        |   2 +-
 .../tool/travis/before_script.sh                   |   2 +-
 .../tool/travis/install.sh                         |   2 +-
 storage/myisam/CMakeLists.txt                      |   2 +-
 storage/myisam/ft_boolean_search.c                 |   2 +-
 storage/myisam/ft_myisam.c                         |   2 +-
 storage/myisam/ft_nlq_search.c                     |   2 +-
 storage/myisam/ft_parser.c                         |   2 +-
 storage/myisam/ft_static.c                         |   2 +-
 storage/myisam/ft_stopwords.c                      |   2 +-
 storage/myisam/ft_update.c                         |   2 +-
 storage/myisam/ftbench/Ecompare.pl                 |   2 +-
 storage/myisam/ftbench/Ecreate.pl                  |   2 +-
 storage/myisam/ftbench/Ereport.pl                  |   2 +-
 storage/myisam/ftbench/ft-test-run.sh              |   2 +-
 storage/myisam/ftdefs.h                            |   2 +-
 storage/myisam/fulltext.h                          |   2 +-
 storage/myisam/ha_myisam.cc                        |   9 +-
 storage/myisam/ha_myisam.h                         |   3 +-
 storage/myisam/mi_cache.c                          |   2 +-
 storage/myisam/mi_changed.c                        |   2 +-
 storage/myisam/mi_check.c                          |   2 +-
 storage/myisam/mi_checksum.c                       |   2 +-
 storage/myisam/mi_close.c                          |   2 +-
 storage/myisam/mi_create.c                         |   2 +-
 storage/myisam/mi_dbug.c                           |   2 +-
 storage/myisam/mi_delete.c                         |   2 +-
 storage/myisam/mi_delete_all.c                     |   2 +-
 storage/myisam/mi_delete_table.c                   |   2 +-
 storage/myisam/mi_dynrec.c                         |   2 +-
 storage/myisam/mi_extra.c                          |   2 +-
 storage/myisam/mi_extrafunc.h                      |   2 +-
 storage/myisam/mi_info.c                           |   2 +-
 storage/myisam/mi_key.c                            |   2 +-
 storage/myisam/mi_keycache.c                       |   2 +-
 storage/myisam/mi_locking.c                        |   2 +-
 storage/myisam/mi_log.c                            |   2 +-
 storage/myisam/mi_open.c                           |   2 +-
 storage/myisam/mi_packrec.c                        |   2 +-
 storage/myisam/mi_page.c                           |   2 +-
 storage/myisam/mi_panic.c                          |   2 +-
 storage/myisam/mi_preload.c                        |   2 +-
 storage/myisam/mi_range.c                          |   2 +-
 storage/myisam/mi_rename.c                         |   2 +-
 storage/myisam/mi_rfirst.c                         |   2 +-
 storage/myisam/mi_rkey.c                           |   2 +-
 storage/myisam/mi_rlast.c                          |   2 +-
 storage/myisam/mi_rnext.c                          |   2 +-
 storage/myisam/mi_rnext_same.c                     |   2 +-
 storage/myisam/mi_rprev.c                          |   2 +-
 storage/myisam/mi_rrnd.c                           |   2 +-
 storage/myisam/mi_rsame.c                          |   2 +-
 storage/myisam/mi_rsamepos.c                       |   2 +-
 storage/myisam/mi_scan.c                           |   2 +-
 storage/myisam/mi_search.c                         |   2 +-
 storage/myisam/mi_static.c                         |   2 +-
 storage/myisam/mi_statrec.c                        |   2 +-
 storage/myisam/mi_test1.c                          |   2 +-
 storage/myisam/mi_test2.c                          |   2 +-
 storage/myisam/mi_test3.c                          |   2 +-
 storage/myisam/mi_test_all.sh                      |   2 +-
 storage/myisam/mi_unique.c                         |   2 +-
 storage/myisam/mi_update.c                         |   2 +-
 storage/myisam/mi_write.c                          |   3 +-
 storage/myisam/myisam_ftdump.c                     |   2 +-
 storage/myisam/myisamchk.c                         |   2 +-
 storage/myisam/myisamdef.h                         |   2 +-
 storage/myisam/myisamlog.c                         |   2 +-
 storage/myisam/myisampack.c                        |   2 +-
 storage/myisam/rt_index.c                          |   2 +-
 storage/myisam/rt_index.h                          |   2 +-
 storage/myisam/rt_key.c                            |   2 +-
 storage/myisam/rt_key.h                            |   2 +-
 storage/myisam/rt_mbr.c                            |   2 +-
 storage/myisam/rt_mbr.h                            |   2 +-
 storage/myisam/rt_split.c                          |   2 +-
 storage/myisam/rt_test.c                           |   2 +-
 storage/myisam/sort.c                              |   2 +-
 storage/myisam/sp_defs.h                           |   2 +-
 storage/myisam/sp_key.c                            |   2 +-
 storage/myisam/sp_test.c                           |   2 +-
 storage/myisammrg/CMakeLists.txt                   |   2 +-
 storage/myisammrg/ha_myisammrg.cc                  |   2 +-
 storage/myisammrg/ha_myisammrg.h                   |   2 +-
 storage/myisammrg/myrg_close.c                     |   2 +-
 storage/myisammrg/myrg_create.c                    |   2 +-
 storage/myisammrg/myrg_def.h                       |   2 +-
 storage/myisammrg/myrg_delete.c                    |   2 +-
 storage/myisammrg/myrg_extra.c                     |   2 +-
 storage/myisammrg/myrg_info.c                      |   2 +-
 storage/myisammrg/myrg_locking.c                   |   2 +-
 storage/myisammrg/myrg_open.c                      |   2 +-
 storage/myisammrg/myrg_panic.c                     |   2 +-
 storage/myisammrg/myrg_queue.c                     |   2 +-
 storage/myisammrg/myrg_range.c                     |   2 +-
 storage/myisammrg/myrg_records.c                   |   2 +-
 storage/myisammrg/myrg_rfirst.c                    |   2 +-
 storage/myisammrg/myrg_rkey.c                      |   2 +-
 storage/myisammrg/myrg_rlast.c                     |   2 +-
 storage/myisammrg/myrg_rnext.c                     |   2 +-
 storage/myisammrg/myrg_rnext_same.c                |   2 +-
 storage/myisammrg/myrg_rprev.c                     |   2 +-
 storage/myisammrg/myrg_rrnd.c                      |   2 +-
 storage/myisammrg/myrg_rsame.c                     |   2 +-
 storage/myisammrg/myrg_static.c                    |   2 +-
 storage/myisammrg/myrg_update.c                    |   2 +-
 storage/myisammrg/myrg_write.c                     |   2 +-
 storage/oqgraph/graphcore-config.h                 |   2 +-
 storage/oqgraph/graphcore-graph.cc                 |   2 +-
 storage/oqgraph/graphcore-graph.h                  |   2 +-
 storage/oqgraph/graphcore-types.h                  |   2 +-
 storage/oqgraph/graphcore.cc                       |   2 +-
 storage/oqgraph/graphcore.h                        |   2 +-
 storage/oqgraph/ha_oqgraph.cc                      |   2 +-
 storage/oqgraph/ha_oqgraph.h                       |   2 +-
 storage/oqgraph/oqgraph_judy.cc                    |   2 +-
 storage/oqgraph/oqgraph_judy.h                     |   2 +-
 storage/oqgraph/oqgraph_probes.d                   |   2 +-
 storage/oqgraph/oqgraph_shim.cc                    |   2 +-
 storage/oqgraph/oqgraph_shim.h                     |   2 +-
 storage/oqgraph/oqgraph_thunk.cc                   |   2 +-
 storage/oqgraph/oqgraph_thunk.h                    |   2 +-
 storage/perfschema/CMakeLists.txt                  |   2 +-
 storage/perfschema/cursor_by_account.cc            |   2 +-
 storage/perfschema/cursor_by_account.h             |   2 +-
 storage/perfschema/cursor_by_host.cc               |   2 +-
 storage/perfschema/cursor_by_host.h                |   2 +-
 storage/perfschema/cursor_by_thread.cc             |   2 +-
 storage/perfschema/cursor_by_thread.h              |   2 +-
 .../perfschema/cursor_by_thread_connect_attr.cc    |   2 +-
 storage/perfschema/cursor_by_thread_connect_attr.h |   2 +-
 storage/perfschema/cursor_by_user.cc               |   2 +-
 storage/perfschema/cursor_by_user.h                |   2 +-
 storage/perfschema/gen_pfs_lex_token.cc            |   2 +-
 storage/perfschema/ha_perfschema.cc                |   2 +-
 storage/perfschema/ha_perfschema.h                 |   2 +-
 storage/perfschema/pfs.cc                          |   2 +-
 storage/perfschema/pfs.h                           |   2 +-
 storage/perfschema/pfs_account.cc                  |   2 +-
 storage/perfschema/pfs_account.h                   |   2 +-
 storage/perfschema/pfs_atomic.h                    |   2 +-
 storage/perfschema/pfs_autosize.cc                 |   2 +-
 storage/perfschema/pfs_column_types.h              |   2 +-
 storage/perfschema/pfs_column_values.cc            |   2 +-
 storage/perfschema/pfs_column_values.h             |   2 +-
 storage/perfschema/pfs_con_slice.cc                |   2 +-
 storage/perfschema/pfs_con_slice.h                 |   2 +-
 storage/perfschema/pfs_defaults.cc                 |   2 +-
 storage/perfschema/pfs_defaults.h                  |   2 +-
 storage/perfschema/pfs_digest.cc                   |   2 +-
 storage/perfschema/pfs_digest.h                    |   2 +-
 storage/perfschema/pfs_engine_table.cc             |   2 +-
 storage/perfschema/pfs_engine_table.h              |   2 +-
 storage/perfschema/pfs_events.h                    |   2 +-
 storage/perfschema/pfs_events_stages.cc            |   2 +-
 storage/perfschema/pfs_events_stages.h             |   2 +-
 storage/perfschema/pfs_events_statements.cc        |   2 +-
 storage/perfschema/pfs_events_statements.h         |   2 +-
 storage/perfschema/pfs_events_waits.cc             |   2 +-
 storage/perfschema/pfs_events_waits.h              |   2 +-
 storage/perfschema/pfs_global.cc                   |   2 +-
 storage/perfschema/pfs_global.h                    |   2 +-
 storage/perfschema/pfs_host.cc                     |   2 +-
 storage/perfschema/pfs_host.h                      |   2 +-
 storage/perfschema/pfs_instr.cc                    |   2 +-
 storage/perfschema/pfs_instr.h                     |   2 +-
 storage/perfschema/pfs_instr_class.cc              |   2 +-
 storage/perfschema/pfs_instr_class.h               |   2 +-
 storage/perfschema/pfs_lock.h                      |   2 +-
 storage/perfschema/pfs_server.cc                   |   2 +-
 storage/perfschema/pfs_server.h                    |   2 +-
 storage/perfschema/pfs_setup_actor.cc              |   2 +-
 storage/perfschema/pfs_setup_actor.h               |   2 +-
 storage/perfschema/pfs_setup_object.cc             |   2 +-
 storage/perfschema/pfs_setup_object.h              |   2 +-
 storage/perfschema/pfs_stat.h                      |   2 +-
 storage/perfschema/pfs_timer.cc                    |  25 +-
 storage/perfschema/pfs_timer.h                     |   4 +-
 storage/perfschema/pfs_user.cc                     |   2 +-
 storage/perfschema/pfs_user.h                      |   2 +-
 storage/perfschema/pfs_visitor.cc                  |   2 +-
 storage/perfschema/pfs_visitor.h                   |   2 +-
 storage/perfschema/table_accounts.cc               |   2 +-
 storage/perfschema/table_accounts.h                |   2 +-
 storage/perfschema/table_all_instr.cc              |   2 +-
 storage/perfschema/table_all_instr.h               |   2 +-
 .../table_esgs_by_account_by_event_name.cc         |   2 +-
 .../table_esgs_by_account_by_event_name.h          |   2 +-
 .../perfschema/table_esgs_by_host_by_event_name.cc |   2 +-
 .../perfschema/table_esgs_by_host_by_event_name.h  |   2 +-
 .../table_esgs_by_thread_by_event_name.cc          |   2 +-
 .../table_esgs_by_thread_by_event_name.h           |   2 +-
 .../perfschema/table_esgs_by_user_by_event_name.cc |   2 +-
 .../perfschema/table_esgs_by_user_by_event_name.h  |   2 +-
 .../perfschema/table_esgs_global_by_event_name.cc  |   2 +-
 .../perfschema/table_esgs_global_by_event_name.h   |   2 +-
 .../table_esms_by_account_by_event_name.cc         |   2 +-
 .../table_esms_by_account_by_event_name.h          |   2 +-
 storage/perfschema/table_esms_by_digest.cc         |   2 +-
 storage/perfschema/table_esms_by_digest.h          |   2 +-
 .../perfschema/table_esms_by_host_by_event_name.cc |   2 +-
 .../perfschema/table_esms_by_host_by_event_name.h  |   2 +-
 .../table_esms_by_thread_by_event_name.cc          |   2 +-
 .../table_esms_by_thread_by_event_name.h           |   2 +-
 .../perfschema/table_esms_by_user_by_event_name.cc |   2 +-
 .../perfschema/table_esms_by_user_by_event_name.h  |   2 +-
 .../perfschema/table_esms_global_by_event_name.cc  |   2 +-
 .../perfschema/table_esms_global_by_event_name.h   |   2 +-
 storage/perfschema/table_events_stages.cc          |   2 +-
 storage/perfschema/table_events_stages.h           |   2 +-
 storage/perfschema/table_events_statements.cc      |   2 +-
 storage/perfschema/table_events_statements.h       |   2 +-
 storage/perfschema/table_events_waits.cc           |   2 +-
 storage/perfschema/table_events_waits.h            |   2 +-
 storage/perfschema/table_events_waits_summary.cc   |   2 +-
 storage/perfschema/table_events_waits_summary.h    |   2 +-
 .../table_ews_by_account_by_event_name.cc          |   2 +-
 .../table_ews_by_account_by_event_name.h           |   2 +-
 .../perfschema/table_ews_by_host_by_event_name.cc  |   2 +-
 .../perfschema/table_ews_by_host_by_event_name.h   |   2 +-
 .../table_ews_by_thread_by_event_name.cc           |   2 +-
 .../perfschema/table_ews_by_thread_by_event_name.h |   2 +-
 .../perfschema/table_ews_by_user_by_event_name.cc  |   2 +-
 .../perfschema/table_ews_by_user_by_event_name.h   |   2 +-
 .../perfschema/table_ews_global_by_event_name.cc   |   4 +-
 .../perfschema/table_ews_global_by_event_name.h    |   4 +-
 storage/perfschema/table_file_instances.cc         |   2 +-
 storage/perfschema/table_file_instances.h          |   2 +-
 .../perfschema/table_file_summary_by_event_name.cc |   2 +-
 .../perfschema/table_file_summary_by_event_name.h  |   2 +-
 .../perfschema/table_file_summary_by_instance.cc   |   2 +-
 .../perfschema/table_file_summary_by_instance.h    |   2 +-
 storage/perfschema/table_helper.cc                 |   2 +-
 storage/perfschema/table_helper.h                  |   2 +-
 storage/perfschema/table_host_cache.cc             |   2 +-
 storage/perfschema/table_host_cache.h              |   2 +-
 storage/perfschema/table_hosts.cc                  |   2 +-
 storage/perfschema/table_hosts.h                   |   2 +-
 storage/perfschema/table_os_global_by_type.cc      |   2 +-
 storage/perfschema/table_os_global_by_type.h       |   2 +-
 storage/perfschema/table_performance_timers.cc     |  12 +-
 storage/perfschema/table_performance_timers.h      |   2 +-
 .../table_session_account_connect_attrs.cc         |   2 +-
 .../table_session_account_connect_attrs.h          |   2 +-
 storage/perfschema/table_session_connect.cc        |   2 +-
 storage/perfschema/table_session_connect.h         |   2 +-
 storage/perfschema/table_session_connect_attrs.cc  |   2 +-
 storage/perfschema/table_session_connect_attrs.h   |   2 +-
 storage/perfschema/table_setup_actors.cc           |   2 +-
 storage/perfschema/table_setup_actors.h            |   2 +-
 storage/perfschema/table_setup_consumers.cc        |   2 +-
 storage/perfschema/table_setup_consumers.h         |   2 +-
 storage/perfschema/table_setup_instruments.cc      |   2 +-
 storage/perfschema/table_setup_instruments.h       |   2 +-
 storage/perfschema/table_setup_objects.cc          |   2 +-
 storage/perfschema/table_setup_objects.h           |   2 +-
 storage/perfschema/table_setup_timers.cc           |   2 +-
 storage/perfschema/table_setup_timers.h            |   2 +-
 storage/perfschema/table_socket_instances.cc       |   2 +-
 storage/perfschema/table_socket_instances.h        |   2 +-
 .../table_socket_summary_by_event_name.cc          |   2 +-
 .../table_socket_summary_by_event_name.h           |   2 +-
 .../perfschema/table_socket_summary_by_instance.cc |   2 +-
 .../perfschema/table_socket_summary_by_instance.h  |   2 +-
 storage/perfschema/table_sync_instances.cc         |   2 +-
 storage/perfschema/table_sync_instances.h          |   2 +-
 storage/perfschema/table_threads.cc                |   2 +-
 storage/perfschema/table_threads.h                 |   2 +-
 storage/perfschema/table_tiws_by_index_usage.cc    |   2 +-
 storage/perfschema/table_tiws_by_index_usage.h     |   2 +-
 storage/perfschema/table_tiws_by_table.cc          |   2 +-
 storage/perfschema/table_tiws_by_table.h           |   2 +-
 storage/perfschema/table_tlws_by_table.cc          |   2 +-
 storage/perfschema/table_tlws_by_table.h           |   2 +-
 storage/perfschema/table_users.cc                  |   2 +-
 storage/perfschema/table_users.h                   |   2 +-
 storage/perfschema/unittest/CMakeLists.txt         |   4 +-
 storage/perfschema/unittest/conf.txt               |   2 +-
 storage/perfschema/unittest/pfs-t.cc               |   2 +-
 storage/perfschema/unittest/pfs_account-oom-t.cc   |   2 +-
 storage/perfschema/unittest/pfs_connect_attr-t.cc  |   2 +-
 storage/perfschema/unittest/pfs_host-oom-t.cc      |   2 +-
 storage/perfschema/unittest/pfs_instr-oom-t.cc     |   2 +-
 storage/perfschema/unittest/pfs_instr-t.cc         |   2 +-
 .../perfschema/unittest/pfs_instr_class-oom-t.cc   |   2 +-
 storage/perfschema/unittest/pfs_instr_class-t.cc   |   2 +-
 storage/perfschema/unittest/pfs_misc-t.cc          |   2 +-
 storage/perfschema/unittest/pfs_server_stubs.cc    |   4 +-
 storage/perfschema/unittest/pfs_timer-t.cc         |   4 +-
 storage/perfschema/unittest/pfs_user-oom-t.cc      |   2 +-
 storage/perfschema/unittest/stub_pfs_defaults.h    |   2 +-
 storage/perfschema/unittest/stub_pfs_global.h      |   2 +-
 storage/perfschema/unittest/stub_print_error.h     |   2 +-
 storage/rocksdb/CMakeLists.txt                     |   5 +
 storage/rocksdb/ha_rocksdb.cc                      |  67 +-
 .../mysql-test/rocksdb/r/col_opt_not_null.result   |   6 +-
 .../mysql-test/rocksdb/r/col_opt_null.result       |   6 +-
 .../mysql-test/rocksdb/r/col_opt_unsigned.result   |   6 +-
 .../rocksdb/r/innodb_i_s_tables_disabled.result    | 342 +++++++++++
 .../mysql-test/rocksdb/r/locking_issues.result     | 675 +--------------------
 .../rocksdb/r/locking_issues_case1_1_rc.result     |  30 +
 .../rocksdb/r/locking_issues_case1_1_rr.result     |  30 +
 .../rocksdb/r/locking_issues_case1_2_rc.result     |  30 +
 .../rocksdb/r/locking_issues_case1_2_rr.result     |  30 +
 .../rocksdb/r/locking_issues_case2_rc.result       |  50 ++
 .../rocksdb/r/locking_issues_case2_rc_lsr.result   |  37 ++
 .../rocksdb/r/locking_issues_case2_rr.result       |  50 ++
 .../rocksdb/r/locking_issues_case2_rr_lsr.result   |  37 ++
 .../rocksdb/r/locking_issues_case3_rc.result       |  25 +
 .../rocksdb/r/locking_issues_case3_rr.result       |  23 +
 .../rocksdb/r/locking_issues_case4_rc.result       |  23 +
 .../rocksdb/r/locking_issues_case4_rr.result       |  23 +
 .../rocksdb/r/locking_issues_case5_rc.result       |  29 +
 .../rocksdb/r/locking_issues_case5_rr.result       |  28 +
 .../rocksdb/r/locking_issues_case6_rc.result       |  29 +
 .../rocksdb/r/locking_issues_case6_rr.result       |  28 +
 .../rocksdb/r/locking_issues_case7_rc.result       |  41 ++
 .../rocksdb/r/locking_issues_case7_rc_lsr.result   |  45 ++
 .../rocksdb/r/locking_issues_case7_rr.result       |  41 ++
 .../rocksdb/r/locking_issues_case7_rr_lsr.result   |  45 ++
 .../mysql-test/rocksdb/r/mariadb_plugin.result     |  12 +-
 .../rocksdb/mysql-test/rocksdb/r/type_float.result |   6 +-
 .../t/innodb_i_s_tables_disabled-master.opt        |  30 +
 .../rocksdb/t/innodb_i_s_tables_disabled.test      |  43 ++
 .../mysql-test/rocksdb/t/locking_issues.test       |  66 +-
 .../rocksdb/t/locking_issues_case1_1_rc.test       |   4 +
 .../rocksdb/t/locking_issues_case1_1_rr.test       |   4 +
 .../rocksdb/t/locking_issues_case1_2_rc.test       |   4 +
 .../rocksdb/t/locking_issues_case1_2_rr.test       |   4 +
 .../rocksdb/t/locking_issues_case2_rc.test         |   5 +
 .../rocksdb/t/locking_issues_case2_rc_lsr.test     |   5 +
 .../rocksdb/t/locking_issues_case2_rr.test         |   5 +
 .../rocksdb/t/locking_issues_case2_rr_lsr.test     |   5 +
 .../rocksdb/t/locking_issues_case3_rc.test         |   4 +
 .../rocksdb/t/locking_issues_case3_rr.test         |   4 +
 .../rocksdb/t/locking_issues_case4_rc.test         |   4 +
 .../rocksdb/t/locking_issues_case4_rr.test         |   4 +
 .../rocksdb/t/locking_issues_case5_rc.test         |   4 +
 .../rocksdb/t/locking_issues_case5_rr.test         |   4 +
 .../rocksdb/t/locking_issues_case6_rc.test         |   4 +
 .../rocksdb/t/locking_issues_case6_rr.test         |   4 +
 .../rocksdb/t/locking_issues_case7_rc.test         |   5 +
 .../rocksdb/t/locking_issues_case7_rc_lsr.test     |   5 +
 .../rocksdb/t/locking_issues_case7_rr.test         |   5 +
 .../rocksdb/t/locking_issues_case7_rr_lsr.test     |   5 +
 .../mysql-test/rocksdb/t/mariadb_plugin.test       |  16 +-
 storage/rocksdb/rdb_utils.h                        |   4 +-
 storage/sequence/sequence.cc                       |   2 +-
 storage/spider/ha_spider.cc                        |   2 +-
 storage/spider/ha_spider.h                         |   2 +-
 storage/spider/hs_client/hs_compat.h               |   2 +-
 storage/spider/scripts/install_spider.sql          |   2 +-
 storage/spider/spd_conn.cc                         |   2 +-
 storage/spider/spd_conn.h                          |   2 +-
 storage/spider/spd_copy_tables.cc                  |   2 +-
 storage/spider/spd_copy_tables.h                   |   2 +-
 storage/spider/spd_db_conn.cc                      |   2 +-
 storage/spider/spd_db_conn.h                       |   2 +-
 storage/spider/spd_db_handlersocket.cc             |   2 +-
 storage/spider/spd_db_handlersocket.h              |   2 +-
 storage/spider/spd_db_include.h                    |   2 +-
 storage/spider/spd_db_mysql.cc                     |   2 +-
 storage/spider/spd_db_mysql.h                      |   2 +-
 storage/spider/spd_db_oracle.cc                    |   2 +-
 storage/spider/spd_db_oracle.h                     |   2 +-
 storage/spider/spd_direct_sql.cc                   |   2 +-
 storage/spider/spd_direct_sql.h                    |   2 +-
 storage/spider/spd_err.h                           |   2 +-
 storage/spider/spd_i_s.cc                          |   2 +-
 storage/spider/spd_include.h                       |   2 +-
 storage/spider/spd_malloc.cc                       |   2 +-
 storage/spider/spd_malloc.h                        |   2 +-
 storage/spider/spd_param.cc                        |   2 +-
 storage/spider/spd_param.h                         |   2 +-
 storage/spider/spd_ping_table.cc                   |   2 +-
 storage/spider/spd_ping_table.h                    |   2 +-
 storage/spider/spd_sys_table.cc                    |   2 +-
 storage/spider/spd_sys_table.h                     |   2 +-
 storage/spider/spd_table.cc                        |   2 +-
 storage/spider/spd_table.h                         |   2 +-
 storage/spider/spd_trx.cc                          |   2 +-
 storage/spider/spd_trx.h                           |   2 +-
 storage/spider/spd_udf.cc                          |   2 +-
 storage/spider/spd_udf.h                           |   2 +-
 storage/test_sql_discovery/test_sql_discovery.cc   |   2 +-
 storage/tokudb/.clang-format                       |  40 ++
 storage/tokudb/PerconaFT/COPYING.GPLv2             |   4 +-
 .../PerconaFT/cmake/merge_archives_unix.cmake.in   |   2 +-
 .../PerconaFT/third_party/snappy-1.1.2/aclocal.m4  |   4 +-
 .../PerconaFT/third_party/snappy-1.1.2/configure   |   2 +-
 .../PerconaFT/third_party/snappy-1.1.2/ltmain.sh   |   2 +-
 .../third_party/xz-4.999.9beta/COPYING.GPLv2       |   4 +-
 .../third_party/xz-4.999.9beta/COPYING.LGPLv2.1    |   4 +-
 .../xz-4.999.9beta/build-aux/config.sub            |   2 +-
 .../third_party/xz-4.999.9beta/build-aux/ltmain.sh |   2 +-
 .../PerconaFT/third_party/xz-4.999.9beta/configure |   2 +-
 .../third_party/xz-4.999.9beta/lib/getopt.c        |   2 +-
 .../third_party/xz-4.999.9beta/lib/getopt.in.h     |   2 +-
 .../third_party/xz-4.999.9beta/lib/getopt1.c       |   2 +-
 .../third_party/xz-4.999.9beta/lib/getopt_int.h    |   2 +-
 .../third_party/xz-4.999.9beta/m4/libtool.m4       |   2 +-
 storage/tokudb/ha_tokudb.cc                        |  28 +-
 storage/tokudb/ha_tokudb.h                         |   2 +-
 storage/tokudb/ha_tokudb_mrr_mysql.cc              |   1 +
 .../mysql-test/rpl/r/rpl_tokudb_mixed_dml.result   |   2 +
 .../tokudb/mysql-test/tokudb_bugs/r/PS-5158.result |   6 +
 .../tokudb/mysql-test/tokudb_bugs/r/PS-5163.result |   5 +
 .../mysql-test/tokudb_bugs/t/PS-5158-master.opt    |   2 +
 .../tokudb/mysql-test/tokudb_bugs/t/PS-5158.test   |  27 +
 .../tokudb/mysql-test/tokudb_bugs/t/PS-5163.test   |  11 +
 strings/CMakeLists.txt                             |   2 +-
 strings/conf_to_src.c                              |   4 +-
 strings/ctype-big5.c                               |   2 +-
 strings/ctype-bin.c                                |   2 +-
 strings/ctype-cp932.c                              |   2 +-
 strings/ctype-czech.c                              |   2 +-
 strings/ctype-euc_kr.c                             |   2 +-
 strings/ctype-eucjpms.c                            |   2 +-
 strings/ctype-extra.c                              |   2 +-
 strings/ctype-gb2312.c                             |   2 +-
 strings/ctype-gbk.c                                |   2 +-
 strings/ctype-latin1.c                             |   2 +-
 strings/ctype-mb.c                                 |   2 +-
 strings/ctype-mb.ic                                |   2 +-
 strings/ctype-simple.c                             |   2 +-
 strings/ctype-sjis.c                               |   2 +-
 strings/ctype-uca.c                                |   2 +-
 strings/ctype-ucs2.c                               |   2 +-
 strings/ctype-ujis.c                               |   2 +-
 strings/ctype-utf8.c                               |   2 +-
 strings/ctype-win1250ch.c                          |   2 +-
 strings/ctype.c                                    |   2 +-
 strings/decimal.c                                  |   2 +-
 strings/do_ctype.c                                 |   2 +-
 strings/dtoa.c                                     |   2 +-
 strings/dump_map.c                                 |   2 +-
 strings/my_strchr.c                                |   2 +-
 strings/my_vsnprintf.c                             |   2 +-
 strings/strcoll.ic                                 |   2 +-
 strings/strings_def.h                              |   2 +-
 strings/strmake.c                                  |   2 +-
 strings/strmov_overlapp.c                          |   2 +-
 strings/t_ctype.h                                  |   2 +-
 strings/uca-dump.c                                 |   2 +-
 strings/uctypedump.c                               |   2 +-
 strings/utr11-dump.c                               |   2 +-
 strings/xml.c                                      |   2 +-
 support-files/CMakeLists.txt                       |   2 +-
 support-files/MacOSX/Description.plist.sh          |   2 +-
 support-files/MacOSX/Info.plist.sh                 |   2 +-
 support-files/MacOSX/MySQLCOM                      |   2 +-
 support-files/MacOSX/StartupItem.Description.plist |   2 +-
 support-files/MacOSX/StartupItem.Info.plist        |   2 +-
 support-files/MacOSX/StartupItem.postinstall       |   2 +-
 support-files/MacOSX/StartupParameters.plist.sh    |   2 +-
 support-files/MacOSX/mwar-wrapper                  |   2 +-
 support-files/MacOSX/mwcc-wrapper                  |   2 +-
 support-files/MacOSX/postflight.sh                 |   2 +-
 support-files/MacOSX/preflight.sh                  |   2 +-
 support-files/dtrace/locktime.d                    |   2 +-
 support-files/dtrace/query-execandqc.d             |   2 +-
 support-files/dtrace/query-filesort-time.d         |   2 +-
 support-files/dtrace/query-network-time.d          |   2 +-
 support-files/dtrace/query-parse-time.d            |   2 +-
 support-files/dtrace/query-rowops.d                |   2 +-
 support-files/dtrace/query-time.d                  |   2 +-
 support-files/dtrace/statement-time.d              |   2 +-
 support-files/dtrace/statement-type-aggregate.d    |   2 +-
 support-files/mysql.m4                             |   2 +-
 support-files/rpm/server-postin.sh                 |   2 +-
 tests/CMakeLists.txt                               |   2 +-
 tests/big_record.pl                                |   2 +-
 tests/bug25714.c                                   |   2 +-
 tests/connect_test.c                               |   2 +-
 tests/deadlock_test.c                              |   2 +-
 tests/drop_test.pl                                 |   2 +-
 tests/export.pl                                    |   2 +-
 tests/fork2_test.pl                                |   2 +-
 tests/fork_big.pl                                  |   2 +-
 tests/fork_big2.pl                                 |   2 +-
 tests/grant.pl                                     |   2 +-
 tests/index_corrupt.pl                             |   2 +-
 tests/insert_and_repair.pl                         |   2 +-
 tests/insert_test.c                                |   2 +-
 tests/list_test.c                                  |   2 +-
 tests/lock_test.pl                                 |   2 +-
 tests/mysql_client_fw.c                            |   2 +-
 tests/mysql_client_test.c                          |  23 +-
 tests/pmail.pl                                     |   2 +-
 tests/rename_test.pl                               |   2 +-
 tests/select_test.c                                |   2 +-
 tests/showdb_test.c                                |   2 +-
 tests/ssl_test.c                                   |   2 +-
 tests/table_types.pl                               |   2 +-
 tests/test_delayed_insert.pl                       |   2 +-
 tests/thread_test.c                                |   2 +-
 tests/truncate.pl                                  |   2 +-
 unittest/examples/CMakeLists.txt                   |   2 +-
 unittest/examples/core-t.c                         |   2 +-
 unittest/examples/no_plan-t.c                      |   2 +-
 unittest/examples/simple-t.c                       |   2 +-
 unittest/examples/skip-t.c                         |   2 +-
 unittest/examples/skip_all-t.c                     |   2 +-
 unittest/examples/todo-t.c                         |   2 +-
 unittest/json_lib/CMakeLists.txt                   |   2 +-
 unittest/my_decimal/CMakeLists.txt                 |   2 +-
 unittest/my_decimal/my_decimal-t.cc                |   2 +-
 unittest/mysys/CMakeLists.txt                      |   2 +-
 unittest/mysys/aes-t.c                             |   2 +-
 unittest/mysys/base64-t.c                          |   2 +-
 unittest/mysys/bitmap-t.c                          |   2 +-
 unittest/mysys/dynstring-t.c                       |   2 +-
 unittest/mysys/lf-t.c                              |   2 +-
 unittest/mysys/my_atomic-t.c                       |   2 +-
 unittest/mysys/my_delete-t.c                       |   2 +-
 unittest/mysys/my_malloc-t.c                       |   2 +-
 unittest/mysys/my_rdtsc-t.c                        |   2 +-
 unittest/mysys/my_vsnprintf-t.c                    |   2 +-
 unittest/mysys/thr_template.c                      |   2 +-
 unittest/mysys/waiting_threads-t.c                 |   2 +-
 unittest/mytap/CMakeLists.txt                      |   2 +-
 unittest/mytap/t/basic-t.c                         |   2 +-
 unittest/mytap/tap.c                               |   2 +-
 unittest/mytap/tap.h                               |   2 +-
 unittest/sql/CMakeLists.txt                        |   2 +-
 unittest/sql/explain_filename-t.cc                 |   2 +-
 unittest/sql/mf_iocache-t.cc                       |   2 +-
 unittest/sql/my_apc-t.cc                           |   2 +-
 unittest/strings/strings-t.c                       |   2 +-
 unittest/unit.pl                                   |   2 +-
 vio/CMakeLists.txt                                 |   2 +-
 vio/test-ssl.c                                     |   2 +-
 vio/test-sslclient.c                               |   2 +-
 vio/test-sslserver.c                               |   2 +-
 vio/vio.c                                          |   2 +-
 vio/vio_priv.h                                     |   2 +-
 vio/viopipe.c                                      |   2 +-
 vio/viosocket.c                                    |   2 +-
 vio/viossl.c                                       |   2 +-
 vio/viosslfactories.c                              |   2 +-
 vio/viotest-ssl.c                                  |   2 +-
 vio/viotest-sslconnect.cc                          |   2 +-
 vio/viotest.cc                                     |   2 +-
 win/create_def_file.js                             |   2 +-
 win/packaging/CMakeLists.txt                       |   2 +-
 win/packaging/COPYING.rtf                          |   4 +-
 win/packaging/ca/CMakeLists.txt                    |   2 +-
 win/packaging/ca/CustomAction.cpp                  |   2 +-
 zlib/CMakeLists.txt                                |   2 +-
 3893 files changed, 11761 insertions(+), 6455 deletions(-)

diff --cc README.md
index 8d4a6e7cfab,053831e4cd7..7b115d28fa7
--- a/README.md
+++ b/README.md
@@@ -44,16 -44,9 +44,16 @@@ More help is available from the Maria D
  https://launchpad.net/~maria-discuss
  and the #maria IRC channel on Freenode.
  
 +Live QA for beginner contributors
 +----
 +MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip and IRC.
 +From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays,
 +anyone can ask any questions they’d like, and a live developer will be available to assist.
 +
 +New contributors can ask questions any time, but we will provide immediate feedback during that interval.
  
- License
- --------
 -Licensing:
 -----------
++Licensing
++---------
  
  ***************************************************************************
  
diff --cc client/mysqlimport.c
index 977e0e6ca1e,dbb2e8f7dba..3e250bdd9ed
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@@ -502,8 -521,11 +509,8 @@@ static void safe_exit(int error, MYSQL 
    if (mysql)
      mysql_close(mysql);
  
-   free_defaults(argv_to_free);
    mysql_library_end();
 -#ifdef HAVE_SMEM
 -  my_free(shared_memory_base_name);
 -#endif
+   free_defaults(argv_to_free);
    my_free(opt_password);
    if (error)
      sf_leaking_memory= 1; /* dirty exit, some threads are still running */
diff --cc include/wsrep.h
index df8a88e1c69,a3a58324f3e..fde5c5226e7
--- a/include/wsrep.h
+++ b/include/wsrep.h
@@@ -11,8 -11,10 +11,8 @@@
  
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
  
 -#include <my_config.h>
 -
  #ifndef WSREP_INCLUDED
  #define WSREP_INCLUDED
  
diff --cc mysql-test/main/bootstrap.test
index d75be403f13,97f5da86096..5484cd1a798
--- a/mysql-test/main/bootstrap.test
+++ b/mysql-test/main/bootstrap.test
@@@ -62,14 -59,21 +62,23 @@@ drop table t1
  SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
   and SUPPORT='YES';
  
++--source include/kill_mysqld.inc
  #
  # MDEV-13063 Server crashes in intern_plugin_lock or assertion `plugin_ptr->ref_count == 1' fails in plugin_init
  #
- --source include/kill_mysqld.inc
  --error 1
  --exec $MYSQLD_BOOTSTRAP_CMD --myisam_recover_options=NONE
- --source include/start_mysqld.inc
  
+ #
+ # MDEV-19349 mysql_install_db: segfault at tmp_file_prefix check
+ #
+ --write_file $MYSQLTEST_VARDIR/tmp/1
+ use test;
+ EOF
+ --exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/1 >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
+ --remove_file $MYSQLTEST_VARDIR/tmp/1
+ 
++--source include/start_mysqld.inc
  --echo End of 5.5 tests
  
  --source include/not_windows_embedded.inc
diff --cc mysql-test/main/func_hybrid_type.result
index 91f3949d456,c7ec29f1a49..664a872cf4c
--- a/mysql-test/main/func_hybrid_type.result
+++ b/mysql-test/main/func_hybrid_type.result
@@@ -3448,6 -3448,36 +3448,36 @@@ t1	CREATE TABLE `t1` 
  ) ENGINE=MyISAM DEFAULT CHARSET=latin1
  DROP TABLE t1;
  #
+ # MDEV-11015 Assertion failed: precision > 0 in decimal_bin_size upon SELECT with DISTINCT, CAST and other functions
+ #
+ CREATE TABLE t1 (b LONGBLOB);
+ INSERT IGNORE INTO t1 VALUES ('foo'),('bar');
+ SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATETIME ) ) AS f FROM t1;
+ f
+ NULL
+ Warnings:
 -Warning	1292	Incorrect datetime value: 'foo'
 -Warning	1292	Incorrect datetime value: 'bar'
++Warning	1292	Truncated incorrect datetime value: 'foo'
++Warning	1292	Truncated incorrect datetime value: 'bar'
+ DROP TABLE t1;
+ CREATE TABLE t1 (b LONGBLOB);
+ INSERT IGNORE INTO t1 VALUES ('foo'),('bar');
+ SELECT DISTINCT - GREATEST( b, CAST( NULL AS TIME) ) AS f FROM t1;
+ f
+ NULL
+ Warnings:
 -Warning	1292	Truncated incorrect time value: 'foo'
 -Warning	1292	Truncated incorrect time value: 'bar'
++Warning	1292	Incorrect time value: 'foo'
++Warning	1292	Incorrect time value: 'bar'
+ DROP TABLE t1;
+ CREATE TABLE t1 (b LONGBLOB);
+ INSERT IGNORE INTO t1 VALUES ('foo'),('bar');
+ SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATE) ) AS f FROM t1;
+ f
+ NULL
+ Warnings:
 -Warning	1292	Incorrect datetime value: 'foo'
 -Warning	1292	Incorrect datetime value: 'bar'
++Warning	1292	Truncated incorrect datetime value: 'foo'
++Warning	1292	Truncated incorrect datetime value: 'bar'
+ DROP TABLE t1;
+ #
  # End of 10.1 tests
  #
  #
diff --cc mysql-test/main/grant4.test
index 2715b7c7145,30f08f9eea2..a63bd158a0d
--- a/mysql-test/main/grant4.test
+++ b/mysql-test/main/grant4.test
@@@ -145,6 -145,34 +145,38 @@@ disconnect con1
  drop database mysqltest_db1;
  drop user mysqltest_u1 at localhost;
  
+ #
+ # MDEV-18241 Downgrade from 10.4 to 10.3 crashes
+ #
++source include/switch_to_mysql_user.inc;
+ call mtr.add_suppression("Table 'mysql.user' doesn't exist");
+ call mtr.add_suppression("'mysql.user' is not of type 'TABLE'");
+ rename table mysql.user to mysql.user1;
+ create view mysql.user as select * from mysql.user1;
+ --error ER_WRONG_OBJECT
+ flush privileges;
+ drop view mysql.user;
+ create temporary table mysql.user select * from mysql.user1 limit 0;
+ --error ER_NO_SUCH_TABLE
+ flush privileges;
+ drop temporary table mysql.user;
+ rename table mysql.user1 to mysql.user;
++source include/switch_to_mysql_global_priv.inc;
+ 
+ #
+ # Bug#28986737: RENAMING AND REPLACING MYSQL.USER TABLE CAN LEAD TO A SERVER CRASH
+ #
++source include/switch_to_mysql_user.inc;
+ call mtr.add_suppression('mysql.user table is damaged');
+ rename table mysql.user to mysql.user1;
+ create table mysql.user (Host char(100), User char(100));
+ --error ER_UNKNOWN_ERROR
+ flush privileges;
+ drop table mysql.user;
+ rename table mysql.user1 to mysql.user;
++source include/switch_to_mysql_global_priv.inc;
+ 
+ --echo End of 5.5 tests
  
  --echo #
  --echo # Additional coverage for refactoring which is made as part
diff --cc mysql-test/main/select.result
index 804830c48df,352ab4ddef4..f4fd91233b5
--- a/mysql-test/main/select.result
+++ b/mysql-test/main/select.result
@@@ -2786,19 -2786,19 +2786,19 @@@ id	select_type	table	type	possible_key
  1	SIMPLE	t1	index	key1	key1	5	NULL	4	Using where; Using index
  explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
  id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 -1	SIMPLE	t1	range	key1	key1	5	NULL	3	Using where; Using index
 +1	SIMPLE	t1	index	key1	key1	5	NULL	4	Using where; Using index
  select max(key1) from t1 where key1 <= 0.6158;
  max(key1)
- 0.6158000230789185
+ 0.6158
  select max(key2) from t2 where key2 <= 1.6158;
  max(key2)
- 1.6158000230789185
+ 1.6158
  select min(key1) from t1 where key1 >= 0.3762;
  min(key1)
- 0.37619999051094055
+ 0.3762
  select min(key2) from t2 where key2 >= 1.3762;
  min(key2)
- 1.3761999607086182
+ 1.3762
  select max(key1), min(key2) from t1, t2
  where key1 <= 0.6158 and key2 >= 1.3762;
  max(key1)	min(key2)
diff --cc mysql-test/main/select_jcl6.result
index 31856279ed5,1c7192b75b6..a3544f6be21
--- a/mysql-test/main/select_jcl6.result
+++ b/mysql-test/main/select_jcl6.result
@@@ -2797,19 -2797,19 +2797,19 @@@ id	select_type	table	type	possible_key
  1	SIMPLE	t1	index	key1	key1	5	NULL	4	Using where; Using index
  explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
  id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 -1	SIMPLE	t1	range	key1	key1	5	NULL	3	Using where; Using index
 +1	SIMPLE	t1	index	key1	key1	5	NULL	4	Using where; Using index
  select max(key1) from t1 where key1 <= 0.6158;
  max(key1)
- 0.6158000230789185
+ 0.6158
  select max(key2) from t2 where key2 <= 1.6158;
  max(key2)
- 1.6158000230789185
+ 1.6158
  select min(key1) from t1 where key1 >= 0.3762;
  min(key1)
- 0.37619999051094055
+ 0.3762
  select min(key2) from t2 where key2 >= 1.3762;
  min(key2)
- 1.3761999607086182
+ 1.3762
  select max(key1), min(key2) from t1, t2
  where key1 <= 0.6158 and key2 >= 1.3762;
  max(key1)	min(key2)
diff --cc mysql-test/main/select_pkeycache.result
index 804830c48df,352ab4ddef4..f4fd91233b5
--- a/mysql-test/main/select_pkeycache.result
+++ b/mysql-test/main/select_pkeycache.result
@@@ -2786,19 -2786,19 +2786,19 @@@ id	select_type	table	type	possible_key
  1	SIMPLE	t1	index	key1	key1	5	NULL	4	Using where; Using index
  explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
  id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 -1	SIMPLE	t1	range	key1	key1	5	NULL	3	Using where; Using index
 +1	SIMPLE	t1	index	key1	key1	5	NULL	4	Using where; Using index
  select max(key1) from t1 where key1 <= 0.6158;
  max(key1)
- 0.6158000230789185
+ 0.6158
  select max(key2) from t2 where key2 <= 1.6158;
  max(key2)
- 1.6158000230789185
+ 1.6158
  select min(key1) from t1 where key1 >= 0.3762;
  min(key1)
- 0.37619999051094055
+ 0.3762
  select min(key2) from t2 where key2 >= 1.3762;
  min(key2)
- 1.3761999607086182
+ 1.3762
  select max(key1), min(key2) from t1, t2
  where key1 <= 0.6158 and key2 >= 1.3762;
  max(key1)	min(key2)
diff --cc mysql-test/main/table_value_constr.result
index 1d485af4a4d,318d0a76663..51198ea47d6
--- a/mysql-test/main/table_value_constr.result
+++ b/mysql-test/main/table_value_constr.result
@@@ -2189,3 -2189,400 +2189,400 @@@ EXECUTE stmt
  1 + 1	2	abc
  2	2	abc
  DEALLOCATE PREPARE stmt;
+ #
+ # MDEV-17894: tvc with ORDER BY ... LIMIT
+ #
+ values (5), (7), (1), (3), (4) limit 2;
+ 5
+ 5
+ 7
+ explain extended values (5), (7), (1), (3), (4) limit 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ Warnings:
+ Note	1003	values (5),(7),(1),(3),(4) limit 2
+ values (5), (7), (1), (3), (4) limit 2 offset 1;
+ 5
+ 7
+ 1
+ explain extended values (5), (7), (1), (3), (4) limit 2 offset 1;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ Warnings:
+ Note	1003	values (5),(7),(1),(3),(4) limit 1,2
+ values (5), (7), (1), (3), (4) order by 1 limit 2;
+ 5
+ 1
+ 3
+ explain extended values (5), (7), (1), (3), (4) order by 1 limit 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNIT RESULT	<unit1>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	values (5),(7),(1),(3),(4) order by 1 limit 2
+ values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1;
+ 5
+ 3
+ 4
+ explain extended values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNIT RESULT	<unit1>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	values (5),(7),(1),(3),(4) order by 1 limit 1,2
+ values (5), (7), (1), (3), (4) order by 1;
+ 5
+ 1
+ 3
+ 4
+ 5
+ 7
+ explain extended values (5), (7), (1), (3), (4) order by 1;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNIT RESULT	<unit1>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	values (5),(7),(1),(3),(4) order by 1
+ values (5,90), (7,20), (1,70), (3,50), (4,10) order by 2;
+ 5	90
+ 4	10
+ 7	20
+ 3	50
+ 1	70
+ 5	90
+ explain extended values (5,90), (7,20), (1,70), (3,50), (4,10) order by 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNIT RESULT	<unit1>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	values (5,90),(7,20),(1,70),(3,50),(4,10) order by 2
+ select 2 union (values (5), (7), (1), (3), (4) limit 2);
+ 2
+ 2
+ 5
+ 7
+ explain extended select 2 union (values (5), (7), (1), (3), (4) limit 2);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	/* select#1 */ select 2 AS `2` union (values (5),(7),(1),(3),(4) limit 2)
+ select 2 union (values (5), (7), (1), (3), (4) limit 2 offset 1);
+ 2
+ 2
+ 7
+ 1
+ explain extended select 2 union (values (5), (7), (1), (3), (4) limit 2 offset 1);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	/* select#1 */ select 2 AS `2` union (values (5),(7),(1),(3),(4) limit 1,2)
+ select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2);
+ 2
+ 2
+ 1
+ 3
+ explain extended select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 3	UNION	<derived2>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
+ 2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,3>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	/* select#1 */ select 2 AS `2` union (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2)
+ select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1);
+ 2
+ 2
+ 3
+ 4
+ explain extended select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 3	UNION	<derived2>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
+ 2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,3>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	/* select#1 */ select 2 AS `2` union (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,2)
+ (values (5), (7), (1), (3), (4) limit 2) union select 2;
+ 5
+ 5
+ 7
+ 2
+ explain extended (values (5), (7), (1), (3), (4) limit 2) union select 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(values (5),(7),(1),(3),(4) limit 2) union /* select#2 */ select 2 AS `2`
+ (values (5), (7), (1), (3), (4) limit 2 offset 1) union select 2;
+ 5
+ 7
+ 1
+ 2
+ explain extended (values (5), (7), (1), (3), (4) limit 2 offset 1) union select 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(values (5),(7),(1),(3),(4) limit 1,2) union /* select#2 */ select 2 AS `2`
+ (values (5), (7), (1), (3), (4) order by 1 limit 2) union select 2;
+ 5
+ 1
+ 3
+ 2
+ explain extended (values (5), (7), (1), (3), (4) order by 1 limit 2) union select 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 -1	SUBQUERY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
 -3	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
++1	PRIMARY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
++3	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) union /* select#2 */ select 2 AS `2`
+ (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1) union select 2;
+ 5
+ 3
+ 4
+ 2
+ explain extended (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1) union select 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 -1	SUBQUERY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
 -3	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
++1	PRIMARY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
++3	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,2) union /* select#2 */ select 2 AS `2`
+ select 3 union all (values (5), (7), (1), (3), (4) limit 2 offset 3);
+ 3
+ 3
+ 3
+ 4
+ explain extended select 3 union all (values (5), (7), (1), (3), (4) limit 2 offset 3);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ Warnings:
+ Note	1003	/* select#1 */ select 3 AS `3` union all (values (5),(7),(1),(3),(4) limit 3,2)
+ (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3;
+ 5
+ 3
+ 4
+ 3
+ explain extended (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ Warnings:
+ Note	1003	(values (5),(7),(1),(3),(4) limit 3,2) union all /* select#2 */ select 3 AS `3`
+ select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2);
+ 3
+ 3
+ 1
+ 3
+ explain extended select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 3	UNION	<derived2>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
+ 2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,3>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	/* select#1 */ select 3 AS `3` union all (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2)
+ (values (5), (7), (1), (3), (4) order by 1 limit 2) union all select 3;
+ 5
+ 1
+ 3
+ 3
+ explain extended (values (5), (7), (1), (3), (4) order by 1 limit 2) union all select 3;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 -1	SUBQUERY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
 -3	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
++1	PRIMARY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
++3	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2) union all /* select#2 */ select 3 AS `3`
+ ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+ union
+ ( values (5), (7), (1), (3), (4) order by 1 limit 2 );
+ 5
+ 7
+ 1
+ 3
+ explain extended ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+ union
+ ( values (5), (7), (1), (3), (4) order by 1 limit 2 );
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 3	UNION	<derived2>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
+ 2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,3>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(values (5),(7),(1),(3),(4) limit 1,2) union (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2)
+ ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+ union all
+ ( values (5), (7), (1), (3), (4) order by 1 limit 2 );
+ 5
+ 7
+ 1
+ 1
+ 3
+ explain extended ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+ union all
+ ( values (5), (7), (1), (3), (4) order by 1 limit 2 );
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 3	UNION	<derived2>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
+ 2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,3>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(values (5),(7),(1),(3),(4) limit 1,2) union all (/* select#3 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 2)
+ (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3 order by 1;
+ 5
+ 3
+ 3
+ 4
+ explain extended (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3 order by 1;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	(values (5),(7),(1),(3),(4) limit 3,2) union all /* select#2 */ select 3 AS `3` order by 1
+ (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 order by 1;
+ 5
+ 3
+ 3
+ 4
+ 5
+ explain extended (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 order by 1;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 -1	SUBQUERY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
 -3	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
++1	PRIMARY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
++3	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	(/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,3) union all /* select#2 */ select 3 AS `3` order by 1
+ (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3
+ order by 1 limit 2 offset 1;
+ 5
+ 3
+ 4
+ explain extended (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3
+ order by 1 limit 2 offset 1;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 -1	SUBQUERY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
 -3	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
++1	PRIMARY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
++3	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	(/* select#1 */ select `tvc_0`.`5` AS `5` from (values (5),(7),(1),(3),(4)) `tvc_0` order by 1 limit 1,3) union all /* select#2 */ select 3 AS `3` order by 1 limit 1,2
+ values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3;
+ ERROR 42S22: Unknown column '3' in 'order clause'
+ prepare stmt from "
+ select 2 union (values (5), (7), (1), (3), (4) limit 2)
+ ";
+ execute stmt;
+ 2
+ 2
+ 5
+ 7
+ execute stmt;
+ 2
+ 2
+ 5
+ 7
+ deallocate prepare stmt;
+ prepare stmt from "
+ select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2)
+ ";
+ execute stmt;
+ 2
+ 2
+ 1
+ 3
+ execute stmt;
+ 2
+ 2
+ 1
+ 3
+ deallocate prepare stmt;
+ prepare stmt from "
+ select 3 union all (values (5), (7), (1), (3), (4) limit 2)
+ ";
+ execute stmt;
+ 3
+ 3
+ 5
+ 7
+ execute stmt;
+ 3
+ 3
+ 5
+ 7
+ deallocate prepare stmt;
+ prepare stmt from "
+ select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2)
+ ";
+ execute stmt;
+ 3
+ 3
+ 1
+ 3
+ execute stmt;
+ 3
+ 3
+ 1
+ 3
+ deallocate prepare stmt;
+ prepare stmt from "
+ ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+   union
+ ( values (5), (7), (1), (3), (4) order by 1 limit 2 );
+ ";
+ execute stmt;
+ 5
+ 7
+ 1
+ 3
+ execute stmt;
+ 5
+ 7
+ 1
+ 3
+ deallocate prepare stmt;
+ prepare stmt from "
+ values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3;
+ ";
+ ERROR 42S22: Unknown column '3' in 'order clause'
+ create view v1 as values (5), (7), (1), (3), (4) order by 1 limit 2;
+ show create view v1;
+ View	Create View	character_set_client	collation_connection
+ v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS values (5),(7),(1),(3),(4) order by 1 limit 2	latin1	latin1_swedish_ci
+ select * from v1;
+ 5
+ 1
+ 3
+ drop view v1;
+ create view v1 as
+ ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+ union
+ ( values (5), (7), (1), (3), (4) order by 1 limit 2 );
+ show create view v1;
+ View	Create View	character_set_client	collation_connection
+ v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (values (5),(7),(1),(3),(4) limit 1,2) union (values (5),(7),(1),(3),(4) order by 1 limit 2)	latin1	latin1_swedish_ci
+ select * from v1;
+ 5
+ 7
+ 1
+ 3
+ drop view v1;
+ create view v1 as values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3;
+ ERROR 42S22: Unknown column '3' in 'order clause'
+ create view v1 as
+ ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+ union
+ ( values (5), (7), (1), (3), (4) order by 2 limit 2 );
+ ERROR 42S22: Unknown column '2' in 'order clause'
diff --cc mysql-test/main/timezone2.result
index dd137045d1a,c4d13f6c678..cf3c6e01e25
--- a/mysql-test/main/timezone2.result
+++ b/mysql-test/main/timezone2.result
@@@ -333,227 -333,35 +333,260 @@@ NUL
  # End of 5.3 tests
  #
  #
+ # Start of 10.1 tests
+ #
+ #
+ # MDEV-11895 NO_ZERO_DATE affects timestamp values without any warnings
+ #
+ SET sql_mode = '';
+ CREATE TABLE t1 (a TIMESTAMP NULL) ENGINE = MyISAM;
+ CREATE TABLE t2 (a TIMESTAMP NULL) ENGINE = MyISAM;
+ CREATE TABLE t3 (a TIMESTAMP NULL) ENGINE = MyISAM;
+ SET @@session.time_zone = 'UTC';
+ INSERT INTO t1 VALUES ('2011-10-29 23:00:00');
+ INSERT INTO t1 VALUES ('2011-10-29 23:00:01');
+ INSERT INTO t1 VALUES ('2011-10-29 23:59:59');
+ SET @@session.time_zone = 'Europe/Moscow';
+ SET sql_mode='NO_ZERO_DATE';
+ INSERT INTO t2 SELECT * FROM t1;
+ SET sql_mode='';
+ INSERT INTO t3 SELECT * FROM t1;
+ SELECT UNIX_TIMESTAMP(a), a FROM t2;
+ UNIX_TIMESTAMP(a)	a
+ 1319929200	2011-10-30 02:00:00
+ 1319929201	2011-10-30 02:00:01
+ 1319932799	2011-10-30 02:59:59
+ SELECT UNIX_TIMESTAMP(a), a FROM t3;
+ UNIX_TIMESTAMP(a)	a
+ 1319929200	2011-10-30 02:00:00
+ 1319929201	2011-10-30 02:00:01
+ 1319932799	2011-10-30 02:59:59
+ DROP TABLE t1, t2, t3;
+ #
+ # End of 10.1 tests
+ #
++#
 +# Start of 10.4 tests
 +#
 +#
 +# MDEV-17203 Move fractional second truncation from Item_xxx_typecast::get_date() to Time and Datetime constructors
 +# (an addition for the test for MDEV-4653)
 +SET timestamp=unix_timestamp('2001-02-03 10:20:30');
 +SET old_mode=ZERO_DATE_TIME_CAST;
 +SELECT CONVERT_TZ(TIME('00:00:00'),'+00:00','+7:5');
 +CONVERT_TZ(TIME('00:00:00'),'+00:00','+7:5')
 +NULL
 +Warnings:
 +Warning	1292	Truncated incorrect datetime value: '00:00:00'
 +SELECT CONVERT_TZ(TIME('2010-01-01 00:00:00'),'+00:00','+7:5');
 +CONVERT_TZ(TIME('2010-01-01 00:00:00'),'+00:00','+7:5')
 +NULL
 +Warnings:
 +Warning	1292	Truncated incorrect datetime value: '00:00:00'
 +SET old_mode=DEFAULT;
 +SET timestamp=DEFAULT;
 +#
 +# MDEV-13995 MAX(timestamp) returns a wrong result near DST change
 +#
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526)      /*summer time in Moscow*/);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/);
 +SET time_zone='Europe/Moscow';
 +SELECT a, UNIX_TIMESTAMP(a) FROM t1;
 +a	UNIX_TIMESTAMP(a)
 +2010-10-31 02:25:26	1288477526
 +2010-10-31 02:25:25	1288481125
 +SELECT UNIX_TIMESTAMP(MAX(a)) AS a FROM t1;
 +a
 +1288481125
 +CREATE TABLE t2 (a TIMESTAMP);
 +INSERT INTO t2 SELECT MAX(a) AS a FROM t1;
 +SELECT a, UNIX_TIMESTAMP(a) FROM t2;
 +a	UNIX_TIMESTAMP(a)
 +2010-10-31 02:25:25	1288481125
 +DROP TABLE t2;
 +DROP TABLE t1;
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP);
 +CREATE TABLE t2 (a TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526)      /*summer time in Moscow*/);
 +INSERT INTO t2 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/);
 +SET time_zone='Europe/Moscow';
 +SELECT UNIX_TIMESTAMP(t1.a), UNIX_TIMESTAMP(t2.a) FROM t1,t2;
 +UNIX_TIMESTAMP(t1.a)	UNIX_TIMESTAMP(t2.a)
 +1288477526	1288481125
 +SELECT * FROM t1,t2 WHERE t1.a < t2.a;
 +a	a
 +2010-10-31 02:25:26	2010-10-31 02:25:25
 +DROP TABLE t1,t2;
 +BEGIN NOT ATOMIC
 +DECLARE a,b TIMESTAMP;
 +SET time_zone='+00:00';
 +SET a=FROM_UNIXTIME(1288477526);
 +SET b=FROM_UNIXTIME(1288481125);
 +SELECT a < b;
 +SET time_zone='Europe/Moscow';
 +SELECT a < b;
 +END;
 +$$
 +a < b
 +1
 +a < b
 +1
 +CREATE OR REPLACE FUNCTION f1(uts INT) RETURNS TIMESTAMP
 +BEGIN
 +DECLARE ts TIMESTAMP;
 +DECLARE tz VARCHAR(64) DEFAULT @@time_zone;
 +SET time_zone='+00:00';
 +SET ts=FROM_UNIXTIME(uts);
 +SET time_zone=tz;
 +RETURN ts;
 +END;
 +$$
 +SET time_zone='+00:00';
 +SELECT f1(1288477526) < f1(1288481125);
 +f1(1288477526) < f1(1288481125)
 +1
 +SET time_zone='Europe/Moscow';
 +SELECT f1(1288477526) < f1(1288481125);
 +f1(1288477526) < f1(1288481125)
 +1
 +DROP FUNCTION f1;
 +CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP);
 +SET time_zone='+00:00';
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/,
 +FROM_UNIXTIME(1288481125) /*winter time in Moscow*/);
 +SELECT *, LEAST(a,b) FROM t1;
 +a	b	LEAST(a,b)
 +2010-10-30 22:25:26	2010-10-30 23:25:25	2010-10-30 22:25:26
 +SET time_zone='Europe/Moscow';
 +SELECT *, LEAST(a,b) FROM t1;
 +a	b	LEAST(a,b)
 +2010-10-31 02:25:26	2010-10-31 02:25:25	2010-10-31 02:25:26
 +SELECT UNIX_TIMESTAMP(a), UNIX_TIMESTAMP(b), UNIX_TIMESTAMP(LEAST(a,b)) FROM t1;
 +UNIX_TIMESTAMP(a)	UNIX_TIMESTAMP(b)	UNIX_TIMESTAMP(LEAST(a,b))
 +1288477526	1288481125	1288477526
 +DROP TABLE t1;
 +CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP,c TIMESTAMP);
 +SET time_zone='+00:00';
 +INSERT INTO t1 VALUES (
 +FROM_UNIXTIME(1288477526) /*summer time in Moscow*/,
 +FROM_UNIXTIME(1288481125) /*winter time in Moscow*/,
 +FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
 +SELECT b BETWEEN a AND c FROM t1;
 +b BETWEEN a AND c
 +1
 +SET time_zone='Europe/Moscow';
 +SELECT b BETWEEN a AND c FROM t1;
 +b BETWEEN a AND c
 +1
 +DROP TABLE t1;
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288481125) /*winter time in Moscow*/);
 +SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
 +a	UNIX_TIMESTAMP(a)
 +2010-10-30 22:25:26	1288477526
 +2010-10-30 23:25:25	1288481125
 +SELECT COALESCE(a) AS a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
 +a	UNIX_TIMESTAMP(a)
 +2010-10-30 22:25:26	1288477526
 +2010-10-30 23:25:25	1288481125
 +SET time_zone='Europe/Moscow';
 +SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
 +a	UNIX_TIMESTAMP(a)
 +2010-10-31 02:25:26	1288477526
 +2010-10-31 02:25:25	1288481125
 +SELECT COALESCE(a) AS a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
 +a	UNIX_TIMESTAMP(a)
 +2010-10-31 02:25:26	1288477526
 +2010-10-31 02:25:25	1288481125
 +DROP TABLE t1;
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
 +SET time_zone='Europe/Moscow';
 +SELECT a, UNIX_TIMESTAMP(a) FROM t1 GROUP BY a;
 +a	UNIX_TIMESTAMP(a)
 +2010-10-31 02:25:26	1288477526
 +2010-10-31 02:25:26	1288481126
 +DROP TABLE t1;
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126));
 +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),CASE a WHEN b THEN 'eq' ELSE 'ne' END AS x FROM t1;
 +UNIX_TIMESTAMP(a)	UNIX_TIMESTAMP(b)	x
 +1288477526	1288481126	ne
 +SET time_zone='Europe/Moscow';
 +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),CASE a WHEN b THEN 'eq' ELSE 'ne' END AS x FROM t1;
 +UNIX_TIMESTAMP(a)	UNIX_TIMESTAMP(b)	x
 +1288477526	1288481126	ne
 +DROP TABLE t1;
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP,c TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126),FROM_UNIXTIME(1288481127));
 +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),a IN (b,c) AS x FROM t1;
 +UNIX_TIMESTAMP(a)	UNIX_TIMESTAMP(b)	x
 +1288477526	1288481126	0
 +SET time_zone='Europe/Moscow';
 +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),a IN (b,c) AS x FROM t1;
 +UNIX_TIMESTAMP(a)	UNIX_TIMESTAMP(b)	x
 +1288477526	1288481126	0
 +DROP TABLE t1;
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126));
 +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
 +a	b
 +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
 +a	b
 +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
 +a	b
 +SET time_zone='Europe/Moscow';
 +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
 +a	b
 +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
 +a	b
 +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
 +a	b
 +DROP TABLE t1;
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1100000000),FROM_UNIXTIME(1200000000));
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1100000001),FROM_UNIXTIME(1200000001));
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126));
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1300000000),FROM_UNIXTIME(1400000000));
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1300000001),FROM_UNIXTIME(1400000001));
 +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
 +a	b
 +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
 +a	b
 +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
 +a	b
 +SET time_zone='Europe/Moscow';
 +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
 +a	b
 +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
 +a	b
 +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
 +a	b
 +DROP TABLE t1;
 +#
 +# MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
 +#
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a INT, ts TIMESTAMP) ENGINE=MyISAM;
 +INSERT INTO t1 VALUES (1, FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
 +SET time_zone='Europe/Moscow';
 +CREATE TABLE t2 AS SELECT ts, COALESCE(ts) AS cts FROM t1 GROUP BY cts;
 +SELECT ts, cts, UNIX_TIMESTAMP(ts) AS uts, UNIX_TIMESTAMP(cts) AS ucts FROM t2;
 +ts	cts	uts	ucts
 +2010-10-31 02:25:26	2010-10-31 02:25:26	1288481126	1288481126
 +DROP TABLE t1,t2;
 +SET time_zone=DEFAULT;
 +#
 +# End of 10.4 tests
 +#
diff --cc mysql-test/main/timezone2.test
index db515653651,1e5615502da..e945923da7a
--- a/mysql-test/main/timezone2.test
+++ b/mysql-test/main/timezone2.test
@@@ -309,200 -309,33 +309,231 @@@ SELECT CONVERT_TZ('2001-10-08 00:00:00'
  --echo # End of 5.3 tests
  --echo #
  
+ --echo #
+ --echo # Start of 10.1 tests
+ --echo #
+ 
+ --echo #
+ --echo # MDEV-11895 NO_ZERO_DATE affects timestamp values without any warnings
+ --echo #
+ 
+ SET sql_mode = '';
+ CREATE TABLE t1 (a TIMESTAMP NULL) ENGINE = MyISAM;
+ CREATE TABLE t2 (a TIMESTAMP NULL) ENGINE = MyISAM;
+ CREATE TABLE t3 (a TIMESTAMP NULL) ENGINE = MyISAM;
+ 
+ SET @@session.time_zone = 'UTC';
+ INSERT INTO t1 VALUES ('2011-10-29 23:00:00');
+ INSERT INTO t1 VALUES ('2011-10-29 23:00:01');
+ INSERT INTO t1 VALUES ('2011-10-29 23:59:59');
+ 
+ SET @@session.time_zone = 'Europe/Moscow';
+ SET sql_mode='NO_ZERO_DATE';
+ INSERT INTO t2 SELECT * FROM t1;
+ SET sql_mode='';
+ INSERT INTO t3 SELECT * FROM t1;
+ SELECT UNIX_TIMESTAMP(a), a FROM t2;
+ SELECT UNIX_TIMESTAMP(a), a FROM t3;
+ DROP TABLE t1, t2, t3;
+ 
+ --echo #
+ --echo # End of 10.1 tests
+ --echo #
++
 +--echo #
 +--echo # Start of 10.4 tests
 +--echo #
 +
 +--echo #
 +--echo # MDEV-17203 Move fractional second truncation from Item_xxx_typecast::get_date() to Time and Datetime constructors
 +--echo # (an addition for the test for MDEV-4653)
 +
 +SET timestamp=unix_timestamp('2001-02-03 10:20:30');
 +SET old_mode=ZERO_DATE_TIME_CAST;
 +SELECT CONVERT_TZ(TIME('00:00:00'),'+00:00','+7:5');
 +SELECT CONVERT_TZ(TIME('2010-01-01 00:00:00'),'+00:00','+7:5');
 +SET old_mode=DEFAULT;
 +SET timestamp=DEFAULT;
 +
 +--echo #
 +--echo # MDEV-13995 MAX(timestamp) returns a wrong result near DST change
 +--echo #
 +
 +# MAX()
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526)      /*summer time in Moscow*/);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/);
 +SET time_zone='Europe/Moscow';
 +SELECT a, UNIX_TIMESTAMP(a) FROM t1;
 +SELECT UNIX_TIMESTAMP(MAX(a)) AS a FROM t1;
 +CREATE TABLE t2 (a TIMESTAMP);
 +INSERT INTO t2 SELECT MAX(a) AS a FROM t1;
 +SELECT a, UNIX_TIMESTAMP(a) FROM t2;
 +DROP TABLE t2;
 +DROP TABLE t1;
 +
 +
 +# Comparison
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP);
 +CREATE TABLE t2 (a TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526)      /*summer time in Moscow*/);
 +INSERT INTO t2 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/);
 +SET time_zone='Europe/Moscow';
 +SELECT UNIX_TIMESTAMP(t1.a), UNIX_TIMESTAMP(t2.a) FROM t1,t2;
 +SELECT * FROM t1,t2 WHERE t1.a < t2.a;
 +DROP TABLE t1,t2;
 +
 +
 +# SP variable comparison
 +DELIMITER $$;
 +BEGIN NOT ATOMIC
 +  DECLARE a,b TIMESTAMP;
 +  SET time_zone='+00:00';
 +  SET a=FROM_UNIXTIME(1288477526);
 +  SET b=FROM_UNIXTIME(1288481125);
 +  SELECT a < b;
 +  SET time_zone='Europe/Moscow';
 +  SELECT a < b;
 +END;
 +$$
 +DELIMITER ;$$
 +
 +
 +# SP function comparison
 +DELIMITER $$;
 +CREATE OR REPLACE FUNCTION f1(uts INT) RETURNS TIMESTAMP
 +BEGIN
 +  DECLARE ts TIMESTAMP;
 +  DECLARE tz VARCHAR(64) DEFAULT @@time_zone;
 +  SET time_zone='+00:00';
 +  SET ts=FROM_UNIXTIME(uts);
 +  SET time_zone=tz;
 +  RETURN ts;
 +END;
 +$$
 +DELIMITER ;$$
 +SET time_zone='+00:00';
 +SELECT f1(1288477526) < f1(1288481125);
 +SET time_zone='Europe/Moscow';
 +SELECT f1(1288477526) < f1(1288481125);
 +DROP FUNCTION f1;
 +
 +
 +# LEAST()
 +CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP);
 +SET time_zone='+00:00';
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/,
 +                       FROM_UNIXTIME(1288481125) /*winter time in Moscow*/);
 +SELECT *, LEAST(a,b) FROM t1;
 +SET time_zone='Europe/Moscow';
 +SELECT *, LEAST(a,b) FROM t1;
 +SELECT UNIX_TIMESTAMP(a), UNIX_TIMESTAMP(b), UNIX_TIMESTAMP(LEAST(a,b)) FROM t1;
 +DROP TABLE t1;
 +
 +
 +# BETWEEN
 +CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP,c TIMESTAMP);
 +SET time_zone='+00:00';
 +INSERT INTO t1 VALUES (
 +  FROM_UNIXTIME(1288477526) /*summer time in Moscow*/,
 +  FROM_UNIXTIME(1288481125) /*winter time in Moscow*/,
 +  FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
 +SELECT b BETWEEN a AND c FROM t1;
 +SET time_zone='Europe/Moscow';
 +SELECT b BETWEEN a AND c FROM t1;
 +DROP TABLE t1;
 +
 +
 +# ORDER BY
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288481125) /*winter time in Moscow*/);
 +SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
 +SELECT COALESCE(a) AS a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
 +SET time_zone='Europe/Moscow';
 +SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
 +SELECT COALESCE(a) AS a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
 +DROP TABLE t1;
 +
 +
 +# GROUP BY
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
 +SET time_zone='Europe/Moscow';
 +SELECT a, UNIX_TIMESTAMP(a) FROM t1 GROUP BY a;
 +DROP TABLE t1;
 +
 +
 +# CASE
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126));
 +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),CASE a WHEN b THEN 'eq' ELSE 'ne' END AS x FROM t1;
 +SET time_zone='Europe/Moscow';
 +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),CASE a WHEN b THEN 'eq' ELSE 'ne' END AS x FROM t1;
 +DROP TABLE t1;
 +
 +
 +# IN
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP,c TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126),FROM_UNIXTIME(1288481127));
 +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),a IN (b,c) AS x FROM t1;
 +SET time_zone='Europe/Moscow';
 +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),a IN (b,c) AS x FROM t1;
 +DROP TABLE t1;
 +
 +# Comparison and IN in combination with a subquery (with one row)
 +
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126));
 +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
 +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
 +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
 +
 +SET time_zone='Europe/Moscow';
 +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
 +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
 +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
 +DROP TABLE t1;
 +
 +# Comparison and IN in combinarion with a subquery (with multiple rows)
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP);
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1100000000),FROM_UNIXTIME(1200000000));
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1100000001),FROM_UNIXTIME(1200000001));
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126));
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1300000000),FROM_UNIXTIME(1400000000));
 +INSERT INTO t1 VALUES (FROM_UNIXTIME(1300000001),FROM_UNIXTIME(1400000001));
 +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
 +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
 +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
 +
 +SET time_zone='Europe/Moscow';
 +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1);
 +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
 +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
 +DROP TABLE t1;
 +
 +--echo #
 +--echo # MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
 +--echo #
 +
 +SET time_zone='+00:00';
 +CREATE TABLE t1 (a INT, ts TIMESTAMP) ENGINE=MyISAM;
 +INSERT INTO t1 VALUES (1, FROM_UNIXTIME(1288481126) /*winter time in Moscow*/);
 +SET time_zone='Europe/Moscow';
 +CREATE TABLE t2 AS SELECT ts, COALESCE(ts) AS cts FROM t1 GROUP BY cts;
 +SELECT ts, cts, UNIX_TIMESTAMP(ts) AS uts, UNIX_TIMESTAMP(cts) AS ucts FROM t2;
 +DROP TABLE t1,t2;
 +SET time_zone=DEFAULT;
 +
 +--echo #
 +--echo # End of 10.4 tests
 +--echo #
diff --cc mysql-test/main/type_float.result
index 0ce54c0126c,217fa3aff2a..167c167ad45
--- a/mysql-test/main/type_float.result
+++ b/mysql-test/main/type_float.result
@@@ -841,34 -841,107 +841,133 @@@ DROP TABLE t1
  # End of 10.2 tests
  #
  #
- # Start of 10.4 tests
 -# Start of 10.3 tests
 -#
 -#
+ # MDEV-19468 Hybrid type expressions return wrong format for FLOAT
+ #
+ CREATE TABLE t1 (a FLOAT);
+ INSERT INTO t1 VALUES (0.671437);
+ SELECT a, COALESCE(a), MAX(a), LEAST(a,a), (SELECT a FROM t1) AS c FROM t1;
+ a	COALESCE(a)	MAX(a)	LEAST(a,a)	c
+ 0.671437	0.671437	0.671437	0.671437	0.671437
+ DROP TABLE t1;
+ CREATE TABLE t1 (a FLOAT);
+ INSERT INTO t1 VALUES (0.671437);
+ SELECT
+ CONCAT(a),
+ CONCAT(COALESCE(a)),
+ CONCAT(LEAST(a,a)),
+ CONCAT(MAX(a)),
+ CONCAT((SELECT a FROM t1)) AS c
+ FROM t1;
+ CONCAT(a)	CONCAT(COALESCE(a))	CONCAT(LEAST(a,a))	CONCAT(MAX(a))	c
+ 0.671437	0.671437	0.671437	0.671437	0.671437
+ CREATE TABLE t2 AS SELECT
+ CONCAT(a),
+ CONCAT(COALESCE(a)),
+ CONCAT(LEAST(a,a)),
+ CONCAT(MAX(a)),
+ CONCAT((SELECT a FROM t1)) AS c
+ FROM t1;
+ SELECT * FROM t2;
+ CONCAT(a)	CONCAT(COALESCE(a))	CONCAT(LEAST(a,a))	CONCAT(MAX(a))	c
+ 0.671437	0.671437	0.671437	0.671437	0.671437
+ DROP TABLE t1, t2;
+ #
+ # MDEV-16872 Add CAST(expr AS FLOAT)
+ #
+ SELECT CAST(0.671437 AS FLOAT), CONCAT(CAST(0.671437 AS FLOAT));
+ CAST(0.671437 AS FLOAT)	CONCAT(CAST(0.671437 AS FLOAT))
+ 0.671437	0.671437
+ SELECT CAST(1e40 AS FLOAT), CONCAT(CAST(1e40 AS FLOAT));
+ CAST(1e40 AS FLOAT)	CONCAT(CAST(1e40 AS FLOAT))
+ 3.40282e38	3.40282e38
+ Warnings:
+ Note	1264	Out of range value for column 'CAST(1e40 AS FLOAT)' at row 1
+ Note	1264	Out of range value for column 'CAST(1e40 AS FLOAT)' at row 1
+ SELECT CAST(-1e40 AS FLOAT), CONCAT(CAST(-1e40 AS FLOAT));
+ CAST(-1e40 AS FLOAT)	CONCAT(CAST(-1e40 AS FLOAT))
+ -3.40282e38	-3.40282e38
+ Warnings:
+ Note	1264	Out of range value for column 'CAST(-1e40 AS FLOAT)' at row 1
+ Note	1264	Out of range value for column 'CAST(-1e40 AS FLOAT)' at row 1
+ SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES';
+ CREATE TABLE t1 (a FLOAT);
+ INSERT INTO t1 VALUES (CAST(1e40 AS FLOAT));
+ Warnings:
+ Note	1264	Out of range value for column 'CAST(1e40 AS FLOAT)' at row 1
+ SELECT * FROM t1;
+ a
+ 3.40282e38
+ DROP TABLE t1;
+ SET sql_mode=DEFAULT;
+ EXPLAIN EXTENDED SELECT CAST(0.671437 AS FLOAT);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ Warnings:
+ Note	1003	select cast(0.671437 as float) AS `CAST(0.671437 AS FLOAT)`
+ CREATE TABLE t1 AS SELECT CAST(0.671437 AS FLOAT) AS c1;
+ SHOW CREATE TABLE t1;
+ Table	Create Table
+ t1	CREATE TABLE `t1` (
+   `c1` float DEFAULT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ SELECT * FROM t1;
+ c1
+ 0.671437
+ DROP TABLE t1;
+ CREATE TABLE t1 (a FLOAT);
+ CREATE TABLE t2 AS SELECT CONCAT(a) AS c1, CONCAT(CAST(a AS FLOAT)) AS c2 FROM t1;
+ SHOW CREATE TABLE t2;
+ Table	Create Table
+ t2	CREATE TABLE `t2` (
+   `c1` varchar(12) DEFAULT NULL,
+   `c2` varchar(12) DEFAULT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ DROP TABLE t1, t2;
+ CREATE TABLE t1 (a FLOAT DEFAULT CAST(0.671437 AS FLOAT));
+ SHOW CREATE TABLE t1;
+ Table	Create Table
+ t1	CREATE TABLE `t1` (
+   `a` float DEFAULT (cast(0.671437 as float))
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ DROP TABLE t1;
+ CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a FLOAT);
+ INSERT INTO t1 VALUES (1, 0.671437),(2, 0.671437);
+ DELETE FROM t1 WHERE a=0.671437;
+ SELECT * FROM t1;
+ id	a
+ 1	0.671437
+ 2	0.671437
+ DELETE FROM t1 WHERE a=CAST(0.671437 AS FLOAT);
+ DROP TABLE t1;
+ #
+ # End of 10.3 tests
  #
 +#
 +# MDEV-11362 True condition elimination does not work for DECIMAL and temporal dynamic SQL parameters
 +#
 +CREATE TABLE t1 (a DOUBLE);
 +INSERT INTO t1 VALUES (1),(2),(3);
 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1e0+a<=>1e0+a;
 +id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 +1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	
 +Warnings:
 +Note	1003	select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1
 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING 1e0,1e0;
 +id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 +1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	
 +Warnings:
 +Note	1003	select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1
 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>1e0+a' USING 1e0;
 +id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 +1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	
 +Warnings:
 +Note	1003	select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1
 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1e0+a<=>?+a' USING 1e0;
 +id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 +1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	
 +Warnings:
 +Note	1003	select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1
 +DROP TABLE t1;
 +#
 +# End of 10.4 tests
 +#
diff --cc mysql-test/main/type_float.test
index f42d3445e2a,65c8130b5db..4665c945a76
--- a/mysql-test/main/type_float.test
+++ b/mysql-test/main/type_float.test
@@@ -582,23 -582,78 +582,90 @@@ DROP TABLE t1
  --echo # End of 10.2 tests
  --echo #
  
 ---echo #
 ---echo # Start of 10.3 tests
 ---echo #
 -
+ --echo #
+ --echo # MDEV-19468 Hybrid type expressions return wrong format for FLOAT
+ --echo #
+ 
+ CREATE TABLE t1 (a FLOAT);
+ INSERT INTO t1 VALUES (0.671437);
+ SELECT a, COALESCE(a), MAX(a), LEAST(a,a), (SELECT a FROM t1) AS c FROM t1;
+ DROP TABLE t1;
+ 
+ CREATE TABLE t1 (a FLOAT);
+ INSERT INTO t1 VALUES (0.671437);
+ SELECT
+   CONCAT(a),
+   CONCAT(COALESCE(a)),
+   CONCAT(LEAST(a,a)),
+   CONCAT(MAX(a)),
+   CONCAT((SELECT a FROM t1)) AS c
+ FROM t1;
+ CREATE TABLE t2 AS SELECT
+   CONCAT(a),
+   CONCAT(COALESCE(a)),
+   CONCAT(LEAST(a,a)),
+   CONCAT(MAX(a)),
+   CONCAT((SELECT a FROM t1)) AS c
+ FROM t1;
+ SELECT * FROM t2;
+ DROP TABLE t1, t2;
+ 
+ 
+ --echo #
+ --echo # MDEV-16872 Add CAST(expr AS FLOAT)
+ --echo #
+ 
+ SELECT CAST(0.671437 AS FLOAT), CONCAT(CAST(0.671437 AS FLOAT));
+ SELECT CAST(1e40 AS FLOAT), CONCAT(CAST(1e40 AS FLOAT));
+ SELECT CAST(-1e40 AS FLOAT), CONCAT(CAST(-1e40 AS FLOAT));
+ 
+ SET sql_mode='STRICT_ALL_TABLES,STRICT_TRANS_TABLES';
+ CREATE TABLE t1 (a FLOAT);
+ INSERT INTO t1 VALUES (CAST(1e40 AS FLOAT));
+ SELECT * FROM t1;
+ DROP TABLE t1;
+ SET sql_mode=DEFAULT;
+ 
+ EXPLAIN EXTENDED SELECT CAST(0.671437 AS FLOAT);
+ 
+ CREATE TABLE t1 AS SELECT CAST(0.671437 AS FLOAT) AS c1;
+ SHOW CREATE TABLE t1;
+ SELECT * FROM t1;
+ DROP TABLE t1;
+ 
+ CREATE TABLE t1 (a FLOAT);
+ CREATE TABLE t2 AS SELECT CONCAT(a) AS c1, CONCAT(CAST(a AS FLOAT)) AS c2 FROM t1;
+ SHOW CREATE TABLE t2;
+ DROP TABLE t1, t2;
+ 
+ CREATE TABLE t1 (a FLOAT DEFAULT CAST(0.671437 AS FLOAT));
+ SHOW CREATE TABLE t1;
+ DROP TABLE t1;
+ 
+ CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, a FLOAT);
+ INSERT INTO t1 VALUES (1, 0.671437),(2, 0.671437);
+ DELETE FROM t1 WHERE a=0.671437;
+ SELECT * FROM t1;
+ DELETE FROM t1 WHERE a=CAST(0.671437 AS FLOAT);
+ DROP TABLE t1;
+ 
  
  --echo #
- --echo # Start of 10.4 tests
+ --echo # End of 10.3 tests
  --echo #
 +
 +--echo #
 +--echo # MDEV-11362 True condition elimination does not work for DECIMAL and temporal dynamic SQL parameters
 +--echo #
 +
 +CREATE TABLE t1 (a DOUBLE);
 +INSERT INTO t1 VALUES (1),(2),(3);
 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1e0+a<=>1e0+a;
 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>?+a' USING 1e0,1e0;
 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>1e0+a' USING 1e0;
 +EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1e0+a<=>?+a' USING 1e0;
 +DROP TABLE t1;
 +
 +--echo #
 +--echo # End of 10.4 tests
 +--echo #
diff --cc mysql-test/suite/compat/oracle/r/table_value_constr.result
index 18fce086f6e,f0c7c4eebe1..3e72167d43d
--- a/mysql-test/suite/compat/oracle/r/table_value_constr.result
+++ b/mysql-test/suite/compat/oracle/r/table_value_constr.result
@@@ -2183,3 -2183,324 +2183,324 @@@ VALUES(1 + 1,2,'abc')
  SELECT * FROM (VALUES(1 + 1,2,'abc')) t;
  1 + 1	2	abc
  2	2	abc
+ #
+ # MDEV-17894: tvc with ORDER BY ... LIMIT
+ #
+ values (5), (7), (1), (3), (4) limit 2;
+ 5
+ 5
+ 7
+ explain extended values (5), (7), (1), (3), (4) limit 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ Warnings:
+ Note	1003	values (5),(7),(1),(3),(4) limit 2
+ values (5), (7), (1), (3), (4) limit 2 offset 1;
+ 5
+ 7
+ 1
+ explain extended values (5), (7), (1), (3), (4) limit 2 offset 1;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ Warnings:
+ Note	1003	values (5),(7),(1),(3),(4) limit 1,2
+ values (5), (7), (1), (3), (4) order by 1 limit 2;
+ 5
+ 1
+ 3
+ explain extended values (5), (7), (1), (3), (4) order by 1 limit 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNIT RESULT	<unit1>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	values (5),(7),(1),(3),(4) order by 1 limit 2
+ values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1;
+ 5
+ 3
+ 4
+ explain extended values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNIT RESULT	<unit1>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	values (5),(7),(1),(3),(4) order by 1 limit 1,2
+ values (5), (7), (1), (3), (4) order by 1;
+ 5
+ 1
+ 3
+ 4
+ 5
+ 7
+ explain extended values (5), (7), (1), (3), (4) order by 1;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNIT RESULT	<unit1>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	values (5),(7),(1),(3),(4) order by 1
+ values (5,90), (7,20), (1,70), (3,50), (4,10) order by 2;
+ 5	90
+ 4	10
+ 7	20
+ 3	50
+ 1	70
+ 5	90
+ explain extended values (5,90), (7,20), (1,70), (3,50), (4,10) order by 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNIT RESULT	<unit1>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	values (5,90),(7,20),(1,70),(3,50),(4,10) order by 2
+ select 2 union (values (5), (7), (1), (3), (4) limit 2);
+ 2
+ 2
+ 5
+ 7
+ explain extended select 2 union (values (5), (7), (1), (3), (4) limit 2);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	/* select#1 */ select 2 AS "2" union (values (5),(7),(1),(3),(4) limit 2)
+ select 2 union (values (5), (7), (1), (3), (4) limit 2 offset 1);
+ 2
+ 2
+ 7
+ 1
+ explain extended select 2 union (values (5), (7), (1), (3), (4) limit 2 offset 1);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	/* select#1 */ select 2 AS "2" union (values (5),(7),(1),(3),(4) limit 1,2)
+ select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2);
+ 2
+ 2
+ 1
+ 3
+ explain extended select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 3	UNION	<derived2>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
+ 2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,3>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	/* select#1 */ select 2 AS "2" union (/* select#3 */ select "tvc_0"."5" AS "5" from (values (5),(7),(1),(3),(4)) "tvc_0" order by 1 limit 2)
+ select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1);
+ 2
+ 2
+ 3
+ 4
+ explain extended select 2 union (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 3	UNION	<derived2>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
+ 2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,3>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	/* select#1 */ select 2 AS "2" union (/* select#3 */ select "tvc_0"."5" AS "5" from (values (5),(7),(1),(3),(4)) "tvc_0" order by 1 limit 1,2)
+ (values (5), (7), (1), (3), (4) limit 2) union select 2;
+ 5
+ 5
+ 7
+ 2
+ explain extended (values (5), (7), (1), (3), (4) limit 2) union select 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(values (5),(7),(1),(3),(4) limit 2) union /* select#2 */ select 2 AS "2"
+ (values (5), (7), (1), (3), (4) limit 2 offset 1) union select 2;
+ 5
+ 7
+ 1
+ 2
+ explain extended (values (5), (7), (1), (3), (4) limit 2 offset 1) union select 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(values (5),(7),(1),(3),(4) limit 1,2) union /* select#2 */ select 2 AS "2"
+ (values (5), (7), (1), (3), (4) order by 1 limit 2) union select 2;
+ 5
+ 1
+ 3
+ 2
+ explain extended (values (5), (7), (1), (3), (4) order by 1 limit 2) union select 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 -1	SUBQUERY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
 -3	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
++1	PRIMARY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
++3	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(/* select#1 */ select "tvc_0"."5" AS "5" from (values (5),(7),(1),(3),(4)) "tvc_0" order by 1 limit 2) union /* select#2 */ select 2 AS "2"
+ (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1) union select 2;
+ 5
+ 3
+ 4
+ 2
+ explain extended (values (5), (7), (1), (3), (4) order by 1 limit 2 offset 1) union select 2;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 -1	SUBQUERY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
 -3	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
++1	PRIMARY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
++3	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(/* select#1 */ select "tvc_0"."5" AS "5" from (values (5),(7),(1),(3),(4)) "tvc_0" order by 1 limit 1,2) union /* select#2 */ select 2 AS "2"
+ select 3 union all (values (5), (7), (1), (3), (4) limit 2 offset 3);
+ 3
+ 3
+ 3
+ 4
+ explain extended select 3 union all (values (5), (7), (1), (3), (4) limit 2 offset 3);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ Warnings:
+ Note	1003	/* select#1 */ select 3 AS "3" union all (values (5),(7),(1),(3),(4) limit 3,2)
+ (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3;
+ 5
+ 3
+ 4
+ 3
+ explain extended (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ Warnings:
+ Note	1003	(values (5),(7),(1),(3),(4) limit 3,2) union all /* select#2 */ select 3 AS "3"
+ select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2);
+ 3
+ 3
+ 1
+ 3
+ explain extended select 3 union all (values (5), (7), (1), (3), (4) order by 1 limit 2);
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 3	UNION	<derived2>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
+ 2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,3>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	/* select#1 */ select 3 AS "3" union all (/* select#3 */ select "tvc_0"."5" AS "5" from (values (5),(7),(1),(3),(4)) "tvc_0" order by 1 limit 2)
+ (values (5), (7), (1), (3), (4) order by 1 limit 2) union all select 3;
+ 5
+ 1
+ 3
+ 3
+ explain extended (values (5), (7), (1), (3), (4) order by 1 limit 2) union all select 3;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 -1	SUBQUERY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
 -3	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
++1	PRIMARY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
++3	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(/* select#1 */ select "tvc_0"."5" AS "5" from (values (5),(7),(1),(3),(4)) "tvc_0" order by 1 limit 2) union all /* select#2 */ select 3 AS "3"
+ ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+ union
+ ( values (5), (7), (1), (3), (4) order by 1 limit 2 );
+ 5
+ 7
+ 1
+ 3
+ explain extended ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+ union
+ ( values (5), (7), (1), (3), (4) order by 1 limit 2 );
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 3	UNION	<derived2>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
+ 2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,3>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(values (5),(7),(1),(3),(4) limit 1,2) union (/* select#3 */ select "tvc_0"."5" AS "5" from (values (5),(7),(1),(3),(4)) "tvc_0" order by 1 limit 2)
+ ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+ union all
+ ( values (5), (7), (1), (3), (4) order by 1 limit 2 );
+ 5
+ 7
+ 1
+ 1
+ 3
+ explain extended ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+ union all
+ ( values (5), (7), (1), (3), (4) order by 1 limit 2 );
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 3	UNION	<derived2>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
+ 2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,3>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+ Warnings:
+ Note	1003	(values (5),(7),(1),(3),(4) limit 1,2) union all (/* select#3 */ select "tvc_0"."5" AS "5" from (values (5),(7),(1),(3),(4)) "tvc_0" order by 1 limit 2)
+ (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3 order by 1;
+ 5
+ 3
+ 3
+ 4
+ explain extended (values (5), (7), (1), (3), (4) limit 2 offset 3) union all select 3 order by 1;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+ 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	(values (5),(7),(1),(3),(4) limit 3,2) union all /* select#2 */ select 3 AS "3" order by 1
+ (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 order by 1;
+ 5
+ 3
+ 3
+ 4
+ 5
+ explain extended (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3 order by 1;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 -1	SUBQUERY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
 -3	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
++1	PRIMARY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
++3	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	(/* select#1 */ select "tvc_0"."5" AS "5" from (values (5),(7),(1),(3),(4)) "tvc_0" order by 1 limit 1,3) union all /* select#2 */ select 3 AS "3" order by 1
+ (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3
+ order by 1 limit 2 offset 1;
+ 5
+ 3
+ 4
+ explain extended (values (5), (7), (1), (3), (4) order by 1 limit 3 offset 1) union all select 3
+ order by 1 limit 2 offset 1;
+ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 -1	SUBQUERY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
 -3	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
++1	PRIMARY	<derived3>	ALL	NULL	NULL	NULL	NULL	5	100.00	Using filesort
++3	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ 2	UNION	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+ NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	Using filesort
+ Warnings:
+ Note	1003	(/* select#1 */ select "tvc_0"."5" AS "5" from (values (5),(7),(1),(3),(4)) "tvc_0" order by 1 limit 1,3) union all /* select#2 */ select 3 AS "3" order by 1 limit 1,2
+ values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3;
+ ERROR 42S22: Unknown column '3' in 'order clause'
+ create view v1 as values (5), (7), (1), (3), (4) order by 1 limit 2;
+ show create view v1;
+ View	Create View	character_set_client	collation_connection
+ v1	CREATE VIEW "v1" AS values (5),(7),(1),(3),(4) order by 1 limit 2	latin1	latin1_swedish_ci
+ select * from v1;
+ 5
+ 1
+ 3
+ drop view v1;
+ create view v1 as
+ ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+ union
+ ( values (5), (7), (1), (3), (4) order by 1 limit 2 );
+ show create view v1;
+ View	Create View	character_set_client	collation_connection
+ v1	CREATE VIEW "v1" AS (values (5),(7),(1),(3),(4) limit 1,2) union (values (5),(7),(1),(3),(4) order by 1 limit 2)	latin1	latin1_swedish_ci
+ select * from v1;
+ 5
+ 7
+ 1
+ 3
+ drop view v1;
+ create view v1 as values (5,90), (7,20), (1,70), (3,50), (4,10) order by 3;
+ ERROR 42S22: Unknown column '3' in 'order clause'
+ create view v1 as
+ ( values (5), (7), (1), (3), (4) limit 2 offset 1 )
+ union
+ ( values (5), (7), (1), (3), (4) order by 2 limit 2 );
+ ERROR 42S22: Unknown column '2' in 'order clause'
diff --cc mysql-test/suite/funcs_1/r/is_routines_embedded.result
index ec375e9c5f6,ec68057eaa1..1ac3651f254
--- a/mysql-test/suite/funcs_1/r/is_routines_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_routines_embedded.result
@@@ -197,8 -197,12 +197,12 @@@ sp_6_408002_2	def	db_datadict_2	sp_6_40
  SELECT * FROM db_datadict_2.res_6_408002_2;
  END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
  add_suppression	def	mtr	add_suppression	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	BEGIN   INSERT INTO test_suppressions (pattern) VALUES (pattern);   FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	utf8	utf8_general_ci	latin1_swedish_ci
 -check_testcase	def	mtr	check_testcase	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	BEGIN    SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES     WHERE variable_name NOT IN ('timestamp')      AND variable_name not like "Last_IO_Err*"      AND variable_name != 'INNODB_IBUF_MAX_SIZE'      AND variable_name != 'INNODB_USE_NATIVE_AIO'      AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP'      AND variable_name not like 'GTID%POS'      AND variable_name != 'GTID_BINLOG_STATE'    ORDER BY variable_name;    SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME;    SELECT * FROM INFORMATION_SCHEMA.SCHEMATA     WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema')     ORDER BY BINARY SCHEMA_NAME;    SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES     WHERE table_schema='test';    SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql     FROM INFORMATION_SCHEMA.TABLES       WHERE table_schema='mysql'         ORDE
 R BY tables_in_mysql;   SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql,   	 column_name, ordinal_position, column_default, is_nullable,          data_type, character_maximum_length, character_octet_length,          numeric_precision, numeric_scale, character_set_name,          collation_name, column_type, column_key, extra, column_comment     FROM INFORMATION_SCHEMA.COLUMNS       WHERE table_schema='mysql'         ORDER BY columns_in_mysql;    SELECT * FROM INFORMATION_SCHEMA.EVENTS;   SELECT * FROM INFORMATION_SCHEMA.TRIGGERS          WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert');   SELECT * FROM INFORMATION_SCHEMA.ROUTINES;    SHOW STATUS LIKE 'slave_open_temp_tables';    checksum table     mysql.columns_priv,     mysql.db,     mysql.func,     mysql.help_category,     mysql.help_keyword,     mysql.help_relation,     mysql.host,     mysql.plugin,     mysql.proc,     mysql.procs_priv,     mysql.roles_mapping,     mysql.tables_priv,     mysql.time_zon
 e,     mysql.time_zone_leap_second,     mysql.time_zone_name,     mysql.time_zone_transition,     mysql.time_zone_transition_type,     mysql.user;    SELECT * FROM INFORMATION_SCHEMA.PLUGINS;    select * from information_schema.session_variables     where variable_name = 'debug_sync';  END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	utf8	utf8_general_ci	latin1_swedish_ci
 +check_testcase	def	mtr	check_testcase	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	BEGIN    SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES     WHERE variable_name NOT IN ('timestamp')      AND variable_name not like "Last_IO_Err*"      AND variable_name != 'INNODB_IBUF_MAX_SIZE'      AND variable_name != 'INNODB_USE_NATIVE_AIO'      AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP'      AND variable_name not like 'GTID%POS'      AND variable_name != 'GTID_BINLOG_STATE'    ORDER BY variable_name;    SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME;    SELECT * FROM INFORMATION_SCHEMA.SCHEMATA     WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema')     ORDER BY BINARY SCHEMA_NAME;    SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES     WHERE table_schema='test';    SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql     FROM INFORMATION_SCHEMA.TABLES       WHERE table_schema='mysql'         ORDE
 R BY tables_in_mysql;   SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql,   	 column_name, ordinal_position, column_default, is_nullable,          data_type, character_maximum_length, character_octet_length,          numeric_precision, numeric_scale, character_set_name,          collation_name, column_type, column_key, extra, column_comment     FROM INFORMATION_SCHEMA.COLUMNS       WHERE table_schema='mysql'         ORDER BY columns_in_mysql;    SELECT * FROM INFORMATION_SCHEMA.EVENTS;   SELECT * FROM INFORMATION_SCHEMA.TRIGGERS          WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert');   SELECT * FROM INFORMATION_SCHEMA.ROUTINES;    SHOW STATUS LIKE 'slave_open_temp_tables';    checksum table     mysql.columns_priv,     mysql.db,     mysql.func,     mysql.help_category,     mysql.help_keyword,     mysql.help_relation,     mysql.plugin,     mysql.proc,     mysql.procs_priv,     mysql.roles_mapping,     mysql.tables_priv,     mysql.time_zone,     mysql.tim
 e_zone_leap_second,     mysql.time_zone_name,     mysql.time_zone_transition,     mysql.time_zone_transition_type,     mysql.global_priv;    SELECT * FROM INFORMATION_SCHEMA.PLUGINS;    select * from information_schema.session_variables     where variable_name = 'debug_sync';  END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	utf8	utf8_general_ci	latin1_swedish_ci
  check_warnings	def	mtr	check_warnings	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	BEGIN   DECLARE `pos` bigint unsigned;    SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0;    UPDATE error_log el, global_suppressions gs     SET suspicious=0       WHERE el.suspicious=1 AND el.line REGEXP gs.pattern;    UPDATE error_log el, test_suppressions ts     SET suspicious=0       WHERE el.suspicious=1 AND el.line REGEXP ts.pattern;    SELECT COUNT(*) INTO @num_warnings FROM error_log     WHERE suspicious=1;    IF @num_warnings > 0 THEN     SELECT line         FROM error_log WHERE suspicious=1;     SELECT 2 INTO result;   ELSE     SELECT 0 INTO RESULT;   END IF;    TRUNCATE test_suppressions;   DROP TABLE error_log;  END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	utf8	utf8_general_ci	latin1_swedish_ci
+ AddGeometryColumn	def	mysql	AddGeometryColumn	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	begin
+   set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	INVOKER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
+ DropGeometryColumn	def	mysql	DropGeometryColumn	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	begin
+   set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	INVOKER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
  connect  testuser2, localhost, testuser2, , db_datadict;
  SELECT * FROM information_schema.routines;
  SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DATA_TYPE	CHARACTER_MAXIMUM_LENGTH	CHARACTER_OCTET_LENGTH	NUMERIC_PRECISION	NUMERIC_SCALE	DATETIME_PRECISION	CHARACTER_SET_NAME	COLLATION_NAME	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
@@@ -209,8 -213,12 +213,12 @@@ sp_6_408002_2	def	db_datadict_2	sp_6_40
  SELECT * FROM db_datadict_2.res_6_408002_2;
  END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
  add_suppression	def	mtr	add_suppression	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	BEGIN   INSERT INTO test_suppressions (pattern) VALUES (pattern);   FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	utf8	utf8_general_ci	latin1_swedish_ci
 -check_testcase	def	mtr	check_testcase	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	BEGIN    SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES     WHERE variable_name NOT IN ('timestamp')      AND variable_name not like "Last_IO_Err*"      AND variable_name != 'INNODB_IBUF_MAX_SIZE'      AND variable_name != 'INNODB_USE_NATIVE_AIO'      AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP'      AND variable_name not like 'GTID%POS'      AND variable_name != 'GTID_BINLOG_STATE'    ORDER BY variable_name;    SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME;    SELECT * FROM INFORMATION_SCHEMA.SCHEMATA     WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema')     ORDER BY BINARY SCHEMA_NAME;    SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES     WHERE table_schema='test';    SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql     FROM INFORMATION_SCHEMA.TABLES       WHERE table_schema='mysql'         ORDE
 R BY tables_in_mysql;   SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql,   	 column_name, ordinal_position, column_default, is_nullable,          data_type, character_maximum_length, character_octet_length,          numeric_precision, numeric_scale, character_set_name,          collation_name, column_type, column_key, extra, column_comment     FROM INFORMATION_SCHEMA.COLUMNS       WHERE table_schema='mysql'         ORDER BY columns_in_mysql;    SELECT * FROM INFORMATION_SCHEMA.EVENTS;   SELECT * FROM INFORMATION_SCHEMA.TRIGGERS          WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert');   SELECT * FROM INFORMATION_SCHEMA.ROUTINES;    SHOW STATUS LIKE 'slave_open_temp_tables';    checksum table     mysql.columns_priv,     mysql.db,     mysql.func,     mysql.help_category,     mysql.help_keyword,     mysql.help_relation,     mysql.host,     mysql.plugin,     mysql.proc,     mysql.procs_priv,     mysql.roles_mapping,     mysql.tables_priv,     mysql.time_zon
 e,     mysql.time_zone_leap_second,     mysql.time_zone_name,     mysql.time_zone_transition,     mysql.time_zone_transition_type,     mysql.user;    SELECT * FROM INFORMATION_SCHEMA.PLUGINS;    select * from information_schema.session_variables     where variable_name = 'debug_sync';  END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	utf8	utf8_general_ci	latin1_swedish_ci
 +check_testcase	def	mtr	check_testcase	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	BEGIN    SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES     WHERE variable_name NOT IN ('timestamp')      AND variable_name not like "Last_IO_Err*"      AND variable_name != 'INNODB_IBUF_MAX_SIZE'      AND variable_name != 'INNODB_USE_NATIVE_AIO'      AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP'      AND variable_name not like 'GTID%POS'      AND variable_name != 'GTID_BINLOG_STATE'    ORDER BY variable_name;    SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME;    SELECT * FROM INFORMATION_SCHEMA.SCHEMATA     WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema')     ORDER BY BINARY SCHEMA_NAME;    SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES     WHERE table_schema='test';    SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql     FROM INFORMATION_SCHEMA.TABLES       WHERE table_schema='mysql'         ORDE
 R BY tables_in_mysql;   SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql,   	 column_name, ordinal_position, column_default, is_nullable,          data_type, character_maximum_length, character_octet_length,          numeric_precision, numeric_scale, character_set_name,          collation_name, column_type, column_key, extra, column_comment     FROM INFORMATION_SCHEMA.COLUMNS       WHERE table_schema='mysql'         ORDER BY columns_in_mysql;    SELECT * FROM INFORMATION_SCHEMA.EVENTS;   SELECT * FROM INFORMATION_SCHEMA.TRIGGERS          WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert');   SELECT * FROM INFORMATION_SCHEMA.ROUTINES;    SHOW STATUS LIKE 'slave_open_temp_tables';    checksum table     mysql.columns_priv,     mysql.db,     mysql.func,     mysql.help_category,     mysql.help_keyword,     mysql.help_relation,     mysql.plugin,     mysql.proc,     mysql.procs_priv,     mysql.roles_mapping,     mysql.tables_priv,     mysql.time_zone,     mysql.tim
 e_zone_leap_second,     mysql.time_zone_name,     mysql.time_zone_transition,     mysql.time_zone_transition_type,     mysql.global_priv;    SELECT * FROM INFORMATION_SCHEMA.PLUGINS;    select * from information_schema.session_variables     where variable_name = 'debug_sync';  END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	utf8	utf8_general_ci	latin1_swedish_ci
  check_warnings	def	mtr	check_warnings	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	BEGIN   DECLARE `pos` bigint unsigned;    SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0;    UPDATE error_log el, global_suppressions gs     SET suspicious=0       WHERE el.suspicious=1 AND el.line REGEXP gs.pattern;    UPDATE error_log el, test_suppressions ts     SET suspicious=0       WHERE el.suspicious=1 AND el.line REGEXP ts.pattern;    SELECT COUNT(*) INTO @num_warnings FROM error_log     WHERE suspicious=1;    IF @num_warnings > 0 THEN     SELECT line         FROM error_log WHERE suspicious=1;     SELECT 2 INTO result;   ELSE     SELECT 0 INTO RESULT;   END IF;    TRUNCATE test_suppressions;   DROP TABLE error_log;  END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	utf8	utf8_general_ci	latin1_swedish_ci
+ AddGeometryColumn	def	mysql	AddGeometryColumn	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	begin
+   set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	INVOKER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
+ DropGeometryColumn	def	mysql	DropGeometryColumn	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	begin
+   set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	INVOKER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
  connect  testuser3, localhost, testuser3, , test;
  SELECT * FROM information_schema.routines;
  SPECIFIC_NAME	ROUTINE_CATALOG	ROUTINE_SCHEMA	ROUTINE_NAME	ROUTINE_TYPE	DATA_TYPE	CHARACTER_MAXIMUM_LENGTH	CHARACTER_OCTET_LENGTH	NUMERIC_PRECISION	NUMERIC_SCALE	DATETIME_PRECISION	CHARACTER_SET_NAME	COLLATION_NAME	DTD_IDENTIFIER	ROUTINE_BODY	ROUTINE_DEFINITION	EXTERNAL_NAME	EXTERNAL_LANGUAGE	PARAMETER_STYLE	IS_DETERMINISTIC	SQL_DATA_ACCESS	SQL_PATH	SECURITY_TYPE	CREATED	LAST_ALTERED	SQL_MODE	ROUTINE_COMMENT	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
@@@ -221,8 -229,12 +229,12 @@@ sp_6_408002_2	def	db_datadict_2	sp_6_40
  SELECT * FROM db_datadict_2.res_6_408002_2;
  END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
  add_suppression	def	mtr	add_suppression	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	BEGIN   INSERT INTO test_suppressions (pattern) VALUES (pattern);   FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	utf8	utf8_general_ci	latin1_swedish_ci
 -check_testcase	def	mtr	check_testcase	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	BEGIN    SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES     WHERE variable_name NOT IN ('timestamp')      AND variable_name not like "Last_IO_Err*"      AND variable_name != 'INNODB_IBUF_MAX_SIZE'      AND variable_name != 'INNODB_USE_NATIVE_AIO'      AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP'      AND variable_name not like 'GTID%POS'      AND variable_name != 'GTID_BINLOG_STATE'    ORDER BY variable_name;    SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME;    SELECT * FROM INFORMATION_SCHEMA.SCHEMATA     WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema')     ORDER BY BINARY SCHEMA_NAME;    SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES     WHERE table_schema='test';    SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql     FROM INFORMATION_SCHEMA.TABLES       WHERE table_schema='mysql'         ORDE
 R BY tables_in_mysql;   SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql,   	 column_name, ordinal_position, column_default, is_nullable,          data_type, character_maximum_length, character_octet_length,          numeric_precision, numeric_scale, character_set_name,          collation_name, column_type, column_key, extra, column_comment     FROM INFORMATION_SCHEMA.COLUMNS       WHERE table_schema='mysql'         ORDER BY columns_in_mysql;    SELECT * FROM INFORMATION_SCHEMA.EVENTS;   SELECT * FROM INFORMATION_SCHEMA.TRIGGERS          WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert');   SELECT * FROM INFORMATION_SCHEMA.ROUTINES;    SHOW STATUS LIKE 'slave_open_temp_tables';    checksum table     mysql.columns_priv,     mysql.db,     mysql.func,     mysql.help_category,     mysql.help_keyword,     mysql.help_relation,     mysql.host,     mysql.plugin,     mysql.proc,     mysql.procs_priv,     mysql.roles_mapping,     mysql.tables_priv,     mysql.time_zon
 e,     mysql.time_zone_leap_second,     mysql.time_zone_name,     mysql.time_zone_transition,     mysql.time_zone_transition_type,     mysql.user;    SELECT * FROM INFORMATION_SCHEMA.PLUGINS;    select * from information_schema.session_variables     where variable_name = 'debug_sync';  END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	utf8	utf8_general_ci	latin1_swedish_ci
 +check_testcase	def	mtr	check_testcase	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	BEGIN    SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES     WHERE variable_name NOT IN ('timestamp')      AND variable_name not like "Last_IO_Err*"      AND variable_name != 'INNODB_IBUF_MAX_SIZE'      AND variable_name != 'INNODB_USE_NATIVE_AIO'      AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP'      AND variable_name not like 'GTID%POS'      AND variable_name != 'GTID_BINLOG_STATE'    ORDER BY variable_name;    SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME;    SELECT * FROM INFORMATION_SCHEMA.SCHEMATA     WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema')     ORDER BY BINARY SCHEMA_NAME;    SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES     WHERE table_schema='test';    SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql     FROM INFORMATION_SCHEMA.TABLES       WHERE table_schema='mysql'         ORDE
 R BY tables_in_mysql;   SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql,   	 column_name, ordinal_position, column_default, is_nullable,          data_type, character_maximum_length, character_octet_length,          numeric_precision, numeric_scale, character_set_name,          collation_name, column_type, column_key, extra, column_comment     FROM INFORMATION_SCHEMA.COLUMNS       WHERE table_schema='mysql'         ORDER BY columns_in_mysql;    SELECT * FROM INFORMATION_SCHEMA.EVENTS;   SELECT * FROM INFORMATION_SCHEMA.TRIGGERS          WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert');   SELECT * FROM INFORMATION_SCHEMA.ROUTINES;    SHOW STATUS LIKE 'slave_open_temp_tables';    checksum table     mysql.columns_priv,     mysql.db,     mysql.func,     mysql.help_category,     mysql.help_keyword,     mysql.help_relation,     mysql.plugin,     mysql.proc,     mysql.procs_priv,     mysql.roles_mapping,     mysql.tables_priv,     mysql.time_zone,     mysql.tim
 e_zone_leap_second,     mysql.time_zone_name,     mysql.time_zone_transition,     mysql.time_zone_transition_type,     mysql.global_priv;    SELECT * FROM INFORMATION_SCHEMA.PLUGINS;    select * from information_schema.session_variables     where variable_name = 'debug_sync';  END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	utf8	utf8_general_ci	latin1_swedish_ci
  check_warnings	def	mtr	check_warnings	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	BEGIN   DECLARE `pos` bigint unsigned;    SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0;    UPDATE error_log el, global_suppressions gs     SET suspicious=0       WHERE el.suspicious=1 AND el.line REGEXP gs.pattern;    UPDATE error_log el, test_suppressions ts     SET suspicious=0       WHERE el.suspicious=1 AND el.line REGEXP ts.pattern;    SELECT COUNT(*) INTO @num_warnings FROM error_log     WHERE suspicious=1;    IF @num_warnings > 0 THEN     SELECT line         FROM error_log WHERE suspicious=1;     SELECT 2 INTO result;   ELSE     SELECT 0 INTO RESULT;   END IF;    TRUNCATE test_suppressions;   DROP TABLE error_log;  END	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	DEFINER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	utf8	utf8_general_ci	latin1_swedish_ci
+ AddGeometryColumn	def	mysql	AddGeometryColumn	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	begin
+   set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	INVOKER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
+ DropGeometryColumn	def	mysql	DropGeometryColumn	PROCEDURE		NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	SQL	begin
+   set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end	NULL	NULL	SQL	NO	CONTAINS SQL	NULL	INVOKER	YYYY-MM-DD hh:mm:ss	YYYY-MM-DD hh:mm:ss			root at localhost	latin1	latin1_swedish_ci	latin1_swedish_ci
  connection default;
  disconnect testuser1;
  disconnect testuser2;
diff --cc mysql-test/suite/galera/r/galera_events.result
index 791b0be729d,e925e62cb91..373f063c2bd
--- a/mysql-test/suite/galera/r/galera_events.result
+++ b/mysql-test/suite/galera/r/galera_events.result
@@@ -1,7 -1,7 +1,9 @@@
 +connection node_2;
 +connection node_1;
  connection node_1;
  CREATE EVENT event1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT 1;
+ Warnings:
+ Warning	1105	Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
  connection node_2;
  SELECT DEFINER= 'root at localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1';
  DEFINER= 'root at localhost'	ORIGINATOR = 1	STATUS = 'SLAVESIDE_DISABLED'	EVENT_TYPE = 'ONE TIME'	ON_COMPLETION = 'NOT PRESERVE'
diff --cc mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result
index 09a415d47eb,0fd0f0b505a..88cb6cacc07
--- a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result
+++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result
@@@ -1,7 -1,5 +1,7 @@@
 +connection node_2;
 +connection node_1;
  connection node_1;
- CREATE TABLE ten (f1 INTEGER);
+ CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
  INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
  CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
  connection node_2;
diff --cc mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
index 203d18b85a6,34558283462..31fbb6914c9
--- a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
+++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
@@@ -18,11 -18,13 +18,12 @@@ INSERT INTO ten VALUES (1),(2),(3),(4),
  CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
  
  --connection node_2
+ set session wsrep_sync_wait=15;
  --let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
  SET GLOBAL wsrep_slave_threads = 4;
 ---let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
 +--let $wait_condition = SELECT VARIABLE_VALUE = @@wsrep_slave_threads + 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
  --source include/wait_condition.inc
  
 -
  --connection node_1
  --send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
  
diff --cc mysql-test/suite/innodb/r/foreign-keys.result
index 447013d408d,c4cf3a6a72d..9dee6efcb04
--- a/mysql-test/suite/innodb/r/foreign-keys.result
+++ b/mysql-test/suite/innodb/r/foreign-keys.result
@@@ -100,6 -100,30 +100,30 @@@ CREATE TABLE t2 (b INT, KEY(b)) ENGINE=
  INSERT INTO t2 VALUES(2);
  ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE;
  DROP TABLE t2, t1;
+ #
+ # MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
+ #
+ CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB;
+ CREATE TABLE t2 LIKE t1;
+ FLUSH TABLES;
+ SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go';
+ ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;
+ connect con1, localhost, root;
+ SET debug_sync='now WAIT_FOR ready';
+ SET lock_wait_timeout=1;
+ UPDATE t2 SET pk=10 WHERE pk=1;
+ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
+ DEALLOCATE PREPARE stmt;
 -FLUSH TABLE t2;
+ SET debug_sync='now SIGNAL go';
+ connection default;
+ disconnect con1;
+ connection default;
+ SET debug_sync='reset';
+ SHOW OPEN TABLES FROM test;
+ Database	Table	In_use	Name_locked
++test	t2	0	0
+ DROP TABLE t1, t2;
  create table t1 (a int primary key, b int) engine=innodb;
  create table t2 (c int primary key, d int,
  foreign key (d) references t1 (a) on update cascade) engine=innodb;
diff --cc mysql-test/suite/innodb/r/instant_alter_crash.result
index 528bd9a905a,dde97d084d4..cfcb24f8bb2
--- a/mysql-test/suite/innodb/r/instant_alter_crash.result
+++ b/mysql-test/suite/innodb/r/instant_alter_crash.result
@@@ -15,10 -16,9 +16,10 @@@ ALTER TABLE t1 ADD COLUMN (c3 TEXT NOT 
  connection default;
  SET DEBUG_SYNC='now WAIT_FOR ddl';
  SET GLOBAL innodb_flush_log_at_trx_commit=1;
- INSERT INTO t2 VALUES(3,4,'accusantium doloremque laudantium');
+ COMMIT;
  # Kill the server
  disconnect ddl;
 +# restart
  SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
  SELECT * FROM t1;
  id	c2
diff --cc mysql-test/suite/innodb/t/foreign-keys.test
index 442467b7dbe,be2c891771b..e5950e01a11
--- a/mysql-test/suite/innodb/t/foreign-keys.test
+++ b/mysql-test/suite/innodb/t/foreign-keys.test
@@@ -127,6 -127,38 +127,37 @@@ INSERT INTO t2 VALUES(2)
  ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE;
  DROP TABLE t2, t1;
  
+ 
+ --echo #
+ --echo # MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
+ --echo #
+ CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB;
+ CREATE TABLE t2 LIKE t1;
+ FLUSH TABLES;
+ 
+ SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go';
+ send ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;
+ 
+ connect con1, localhost, root;
+ SET debug_sync='now WAIT_FOR ready';
+ SET lock_wait_timeout=1; # change to 0 in 10.3
+ --error ER_LOCK_WAIT_TIMEOUT
+ UPDATE t2 SET pk=10 WHERE pk=1;
+ PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
+ DEALLOCATE PREPARE stmt;
 -FLUSH TABLE t2;
+ SET debug_sync='now SIGNAL go';
+ 
+ connection default;
+ reap;
+ 
+ # Cleanup
+ disconnect con1;
+ 
+ connection default;
+ SET debug_sync='reset';
+ SHOW OPEN TABLES FROM test;
+ DROP TABLE t1, t2;
+ 
  #
  # FK and prelocking:
  # child table accesses (reads and writes) wait for locks.
diff --cc mysql-test/suite/plugins/r/pam.result
index a16cd7f3d43,46f1223d7b3..1d70f530969
--- a/mysql-test/suite/plugins/r/pam.result
+++ b/mysql-test/suite/plugins/r/pam.result
@@@ -20,13 -20,26 +20,33 @@@ Challenge input first
  Enter: not very secret challenge
  Now, the magic number!
  PIN: ****
 +#
 +# athentication is unsuccessful
 +#
 +Challenge input first.
 +Enter: crash pam module
 +Now, the magic number!
 +PIN: ***
  drop user test_pam;
  drop user pam_test;
+ create user PAM_TEST identified via pam using 'mariadb_mtr';
+ #
+ # athentication is unsuccessful
+ #
+ Challenge input first.
+ Enter: not very secret challenge
+ Now, the magic number!
+ PIN: ****
+ set global pam_winbind_workaround=1;
+ #
+ # athentication is successful
+ #
+ Challenge input first.
+ Enter: not very secret challenge
+ Now, the magic number!
+ PIN: ****
+ select user(), current_user(), database();
+ user()	current_user()	database()
+ PAM_TEST at localhost	PAM_TEST@%	test
+ drop user PAM_TEST;
  uninstall plugin pam;
diff --cc mysql-test/suite/plugins/t/pam.test
index 6bb282f68c0,8441b83c5c3..040b26ef8b8
--- a/mysql-test/suite/plugins/t/pam.test
+++ b/mysql-test/suite/plugins/t/pam.test
@@@ -29,18 -23,28 +29,35 @@@ EO
  --echo # athentication is unsuccessful
  --echo #
  --error 1
- --exec $MYSQL_TEST -u test_pam --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_bad.txt
+ --exec $MYSQL_TEST -u test_pam < $MYSQLTEST_VARDIR/tmp/pam_bad.txt
  
 +--echo #
 +--echo # athentication is unsuccessful
 +--echo #
 +--error 1
 +--exec $MYSQL_TEST -u test_pam --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_ugly.txt
 +
- --remove_file $MYSQLTEST_VARDIR/tmp/pam_good.txt
- --remove_file $MYSQLTEST_VARDIR/tmp/pam_bad.txt
  drop user test_pam;
  drop user pam_test;
+ create user PAM_TEST identified via pam using 'mariadb_mtr';
+ 
+ --echo #
+ --echo # athentication is unsuccessful
+ --echo #
+ --error 1
+ --exec $MYSQL_TEST -u PAM_TEST < $MYSQLTEST_VARDIR/tmp/pam_good.txt
+ 
+ set global pam_winbind_workaround=1;
+ --echo #
+ --echo # athentication is successful
+ --echo #
+ --exec $MYSQL_TEST -u PAM_TEST < $MYSQLTEST_VARDIR/tmp/pam_good.txt
+ 
+ --remove_file $MYSQLTEST_VARDIR/tmp/pam_good.txt
+ --remove_file $MYSQLTEST_VARDIR/tmp/pam_bad.txt
++--remove_file $MYSQLTEST_VARDIR/tmp/pam_ugly.txt
+ drop user PAM_TEST;
+ 
  let $count_sessions= 1;
  --source include/wait_until_count_sessions.inc
  uninstall plugin pam;
diff --cc mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
index 89f59deae73,dce79837700..7dd3907f102
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
@@@ -677,8 -676,11 +677,10 @@@ DROP TRIGGER tr1
  
  
  ******************** EVENTS ********************
 -GRANT EVENT ON *.* TO 'root'@'localhost';
  INSERT INTO t1 VALUES(1, 'test1');
  CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1;
+ Warnings:
+ Warning	1105	Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
  SHOW EVENTS;
  Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation
  test_rpl	e1	root at localhost	SYSTEM	RECURRING	NULL	1	#	#	NULL	ENABLED	1	latin1	latin1_swedish_ci	latin1_swedish_ci
diff --cc plugin/auth_ed25519/server_ed25519.c
index d2e9e70a9b9,81fc3e66755..6fec98c56fc
--- a/plugin/auth_ed25519/server_ed25519.c
+++ b/plugin/auth_ed25519/server_ed25519.c
@@@ -12,10 -12,9 +12,10 @@@
  
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
  
  #include <mysql/plugin_auth.h>
 +#include <mysqld_error.h>
  #include "common.h"
  
  #if !defined(__attribute__) && !defined(__GNUC__)
diff --cc plugin/auth_pam/auth_pam.c
index 779f6ced1ad,fae73aea690..599b323b0b7
--- a/plugin/auth_pam/auth_pam.c
+++ b/plugin/auth_pam/auth_pam.c
@@@ -28,167 -52,160 +28,171 @@@ static char pam_debug = 0
  #define PAM_DEBUG(X)   /* no-op */
  #endif
  
+ static char winbind_hack = 0;
+ 
 -static int conv(int n, const struct pam_message **msg,
 -                struct pam_response **resp, void *data)
 +static char *opt_plugin_dir; /* To be dynamically linked. */
 +static const char *tool_name= "auth_pam_tool_dir/auth_pam_tool";
 +static const int tool_name_len= 31;
 +
 +static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
  {
 -  struct param *param = (struct param *)data;
 -  unsigned char *end = param->buf + sizeof(param->buf) - 1;
 -  int i;
 +  int p_to_c[2], c_to_p[2]; /* Parent-to-child and child-to-parent pipes. */
 +  pid_t proc_id;
 +  int result= CR_ERROR, pkt_len;
 +  unsigned char field, *pkt;
  
 -  *resp = 0;
 +  PAM_DEBUG((stderr, "PAM: opening pipes.\n"));
 +  if (pipe(p_to_c) < 0 || pipe(c_to_p) < 0)
 +  {
 +    /* Error creating pipes. */
 +    return CR_ERROR;
 +  }
 +  PAM_DEBUG((stderr, "PAM: forking.\n"));
 +  if ((proc_id= fork()) < 0)
 +  {
 +    /* Error forking. */
 +    close(p_to_c[0]);
 +    close(c_to_p[1]);
 +    goto error_ret;
 +  }
  
 -  for (i = 0; i < n; i++)
 +  if (proc_id == 0)
    {
 -    /* if there's a message - append it to the buffer */
 -    if (msg[i]->msg)
 +    /* The 'sandbox' process started. */
 +    char toolpath[FN_REFLEN];
 +    size_t plugin_dir_len= strlen(opt_plugin_dir);
 +
 +    PAM_DEBUG((stderr, "PAM: Child process prepares pipes.\n"));
 +    
 +    if (close(p_to_c[1]) < 0 ||
 +        close(c_to_p[0]) < 0 ||
 +        dup2(p_to_c[0], 0) < 0 || /* Parent's pipe to STDIN. */
 +        dup2(c_to_p[1], 1) < 0)   /* Sandbox's pipe to STDOUT. */
      {
 -      int len = strlen(msg[i]->msg);
 -      if (len > end - param->ptr)
 -        len = end - param->ptr;
 -      if (len > 0)
 -      {
 -        memcpy(param->ptr, msg[i]->msg, len);
 -        param->ptr+= len;
 -        *(param->ptr)++ = '\n';
 -      }
 +      exit(-1);
      }
 -    /* if the message style is *_PROMPT_*, meaning PAM asks a question,
 -       send the accumulated text to the client, read the reply */
 -    if (msg[i]->msg_style == PAM_PROMPT_ECHO_OFF ||
 -        msg[i]->msg_style == PAM_PROMPT_ECHO_ON)
 +
 +    PAM_DEBUG((stderr, "PAM: check tool directory: %s, %s.\n",
 +                       opt_plugin_dir, tool_name));
 +    if (plugin_dir_len + tool_name_len + 2 > sizeof(toolpath))
      {
 -      int pkt_len;
 -      unsigned char *pkt;
 +      /* Tool path too long. */
 +      exit(-1);
 +    }
  
 -      /* allocate the response array.
 -         freeing it is the responsibility of the caller */
 -      if (*resp == 0)
 -      {
 -        *resp = calloc(sizeof(struct pam_response), n);
 -        if (*resp == 0)
 -          return PAM_BUF_ERR;
 -      }
 +    memcpy(toolpath, opt_plugin_dir, plugin_dir_len);
 +    if (plugin_dir_len && toolpath[plugin_dir_len-1] != FN_LIBCHAR)
 +      toolpath[plugin_dir_len++]= FN_LIBCHAR;
 +    memcpy(toolpath+plugin_dir_len, tool_name, tool_name_len+1);
  
 -      /* dialog plugin interprets the first byte of the packet
 -         as the magic number.
 -           2 means "read the input with the echo enabled"
 -           4 means "password-like input, echo disabled"
 -         C'est la vie. */
 -      param->buf[0] = msg[i]->msg_style == PAM_PROMPT_ECHO_ON ? 2 : 4;
 -      PAM_DEBUG((stderr, "PAM: conv: send(%.*s)\n", (int)(param->ptr - param->buf - 1), param->buf));
 -      if (param->vio->write_packet(param->vio, param->buf, param->ptr - param->buf - 1))
 -        return PAM_CONV_ERR;
 -
 -      pkt_len = param->vio->read_packet(param->vio, &pkt);
 -      if (pkt_len < 0)
 -      {
 -        PAM_DEBUG((stderr, "PAM: conv: recv() ERROR\n"));
 -        return PAM_CONV_ERR;
 -      }
 -      PAM_DEBUG((stderr, "PAM: conv: recv(%.*s)\n", pkt_len, pkt));
 -      /* allocate and copy the reply to the response array */
 -      if (!((*resp)[i].resp= strndup((char*) pkt, pkt_len)))
 -        return PAM_CONV_ERR;
 -      param->ptr = param->buf + 1;
 -    }
 +    PAM_DEBUG((stderr, "PAM: execute pam sandbox [%s].\n", toolpath));
 +    (void) execl(toolpath, toolpath, NULL);
 +    PAM_DEBUG((stderr, "PAM: exec() failed.\n"));
 +    exit(-1);
    }
 -  return PAM_SUCCESS;
 -}
  
 -#define DO(X) if ((status = (X)) != PAM_SUCCESS) goto end
 +  /* Parent process continues. */
  
 -#if defined(SOLARIS) || defined(__sun)
 -typedef void** pam_get_item_3_arg;
 -#else
 -typedef const void** pam_get_item_3_arg;
 -#endif
 +  PAM_DEBUG((stderr, "PAM: parent continues.\n"));
 +  if (close(p_to_c[0]) < 0 ||
 +      close(c_to_p[1]) < 0)
 +    goto error_ret;
  
 -static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
 -{
 -  pam_handle_t *pamh = NULL;
 -  int status;
 -  const char *new_username= NULL;
 -  struct param param;
 -  /* The following is written in such a way to make also solaris happy */
 -  struct pam_conv pam_start_arg = { &conv, (char*) &param };
 -
 -  /*
 -    get the service name, as specified in
 -
 -     CREATE USER ... IDENTIFIED WITH pam AS "service"
 -  */
 -  const char *service = info->auth_string && info->auth_string[0]
 -                          ? info->auth_string : "mysql";
 -
 -  param.ptr = param.buf + 1;
 -  param.vio = vio;
 -
 -  PAM_DEBUG((stderr, "PAM: pam_start(%s, %s)\n", service, info->user_name));
 -  DO( pam_start(service, info->user_name, &pam_start_arg, &pamh) );
 -
 -  PAM_DEBUG((stderr, "PAM: pam_authenticate(0)\n"));
 -  DO( pam_authenticate (pamh, 0) );
 -
 -  PAM_DEBUG((stderr, "PAM: pam_acct_mgmt(0)\n"));
 -  DO( pam_acct_mgmt(pamh, 0) );
 -
 -  PAM_DEBUG((stderr, "PAM: pam_get_item(PAM_USER)\n"));
 -  DO( pam_get_item(pamh, PAM_USER, (pam_get_item_3_arg) &new_username) );
 -
 -  if (new_username &&
 -      (winbind_hack ? strcasecmp : strcmp)(new_username, info->user_name))
 -    strncpy(info->authenticated_as, new_username,
 -            sizeof(info->authenticated_as)-1);
 -  info->authenticated_as[sizeof(info->authenticated_as)-1]= 0;
 -
 -end:
 -  pam_end(pamh, status);
 -  PAM_DEBUG((stderr, "PAM: status = %d user = %s\n", status, info->authenticated_as));
 -  return status == PAM_SUCCESS ? CR_OK : CR_ERROR;
 -}
 +  /* no user name yet ? read the client handshake packet with the user name */
 +  if (info->user_name == 0)
 +  {
 +    if ((pkt_len= vio->read_packet(vio, &pkt) < 0))
 +      return CR_ERROR;
 +  }
 +  else
 +    pkt= NULL;
  
 -static struct st_mysql_auth info =
 -{
 -  MYSQL_AUTHENTICATION_INTERFACE_VERSION,
 -  "dialog",
 -  pam_auth
 -};
 -
 -static char use_cleartext_plugin;
 -static MYSQL_SYSVAR_BOOL(use_cleartext_plugin, use_cleartext_plugin,
 -       PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
 -       "Use mysql_cleartext_plugin on the client side instead of the dialog "
 -       "plugin. This may be needed for compatibility reasons, but it only "
 -       "supports simple PAM policies that don't require anything besides "
 -       "a password", NULL, NULL, 0);
 -
 -static MYSQL_SYSVAR_BOOL(winbind_workaround, winbind_hack, PLUGIN_VAR_OPCMDARG,
 -       "Compare usernames case insensitively to work around pam_winbind "
 -       "unconditional username lowercasing", NULL, NULL, 0);
 +  PAM_DEBUG((stderr, "PAM: parent sends user data [%s], [%s].\n",
 +               info->user_name, info->auth_string));
  
  #ifndef DBUG_OFF
-   field= pam_debug;
 -static MYSQL_SYSVAR_BOOL(debug, pam_debug, PLUGIN_VAR_OPCMDARG,
 -       "Log all PAM activity", NULL, NULL, 0);
++  field= pam_debug ? 1 : 0;
 +#else
 +  field= 0;
  #endif
++  field|= winbind_hack ? 2 : 0;
+ 
 +  if (write(p_to_c[1], &field, 1) != 1 ||
 +      write_string(p_to_c[1], (const uchar *) info->user_name,
 +                                       info->user_name_length) ||
 +      write_string(p_to_c[1], (const uchar *) info->auth_string,
 +                                      info->auth_string_length))
 +    goto error_ret;
  
 -static struct st_mysql_sys_var* vars[] = {
 -  MYSQL_SYSVAR(use_cleartext_plugin),
 -  MYSQL_SYSVAR(winbind_workaround),
 -#ifndef DBUG_OFF
 -  MYSQL_SYSVAR(debug),
 -#endif
 -  NULL
 -};
 +  for (;;)
 +  {
 +    PAM_DEBUG((stderr, "PAM: listening to the sandbox.\n"));
 +    if (read(c_to_p[0], &field, 1) < 1)
 +    {
 +      PAM_DEBUG((stderr, "PAM: read failed.\n"));
 +      goto error_ret;
 +    }
 +
 +    if (field == AP_EOF)
 +    {
 +      PAM_DEBUG((stderr, "PAM: auth OK returned.\n"));
 +      break;
 +    }
 +
 +    switch (field)
 +    {
 +    case AP_AUTHENTICATED_AS:
 +      PAM_DEBUG((stderr, "PAM: reading authenticated_as string.\n"));
 +      if (read_string(c_to_p[0], info->authenticated_as,
 +                      sizeof(info->authenticated_as) - 1) < 0)
 +        goto error_ret;
 +      break;
 +
 +    case AP_CONV:
 +      {
 +        unsigned char buf[10240];
 +        int buf_len;
 +
 +        PAM_DEBUG((stderr, "PAM: getting CONV string.\n"));
 +        if ((buf_len= read_string(c_to_p[0], (char *) buf, sizeof(buf))) < 0)
 +          goto error_ret;
 +
 +        if (!pkt || (buf[0] >> 1) != 2)
 +        {
 +          PAM_DEBUG((stderr, "PAM: sending CONV string.\n"));
 +          if (vio->write_packet(vio, buf, buf_len))
 +            goto error_ret;
 +
 +          PAM_DEBUG((stderr, "PAM: reading CONV answer.\n"));
 +          if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
 +            goto error_ret;
 +        }
 +
 +        PAM_DEBUG((stderr, "PAM: answering CONV.\n"));
 +        if (write_string(p_to_c[1], pkt, pkt_len))
 +          goto error_ret;
 +
 +        pkt= NULL;
 +      }
 +      break;
 +
 +    default:
 +      PAM_DEBUG((stderr, "PAM: unknown sandbox field.\n"));
 +      goto error_ret;
 +    }
 +  }
 +  result= CR_OK;
 +
 +error_ret:
 +  close(p_to_c[1]);
 +  close(c_to_p[0]);
 +
 +  PAM_DEBUG((stderr, "PAM: auth result %d.\n", result));
 +  return result;
 +}
 +
 +
 +#include "auth_pam_common.c"
  
  
  static int init(void *p __attribute__((unused)))
diff --cc plugin/auth_pam/auth_pam_base.c
index 67a0adbeb2e,00000000000..a23cfcbfd65
mode 100644,000000..100644
--- a/plugin/auth_pam/auth_pam_base.c
+++ b/plugin/auth_pam/auth_pam_base.c
@@@ -1,174 -1,0 +1,177 @@@
 +/*
 +   Copyright (c) 2011, 2018 MariaDB Corporation
 +
 +   This program is free software; you can redistribute it and/or modify
 +   it under the terms of the GNU General Public License as published by
 +   the Free Software Foundation; version 2 of the License.
 +
 +   This program is distributed in the hope that it will be useful,
 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +   GNU General Public License for more details.
 +
 +   You should have received a copy of the GNU General Public License
 +   along with this program; if not, write to the Free Software
 +   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
 +
 +/*
 +  This file contains code to interact with the PAM module.
 +  To be included into auth_pam_tool.c and auth_pam_v2.c,
 +
 +  Before the #include these sould be defined:
 +  
 +  struct param {
 +    unsigned char buf[10240], *ptr;
 +    MYSQL_PLUGIN_VIO *vio;
 +    ...  other arbitrary fields allowed.
 +  };
 +  static int write_packet(struct param *param, const unsigned char *buf,
 +                          int buf_len)
 +  static int read_packet(struct param *param, unsigned char **pkt)
 +*/
 +
 +#include <stdio.h>
 +#include <string.h>
 +#include <security/pam_appl.h>
 +#include <security/pam_modules.h>
 +
 +/* It least solaris doesn't have strndup */
 +
 +#ifndef HAVE_STRNDUP
 +char *strndup(const char *from, size_t length)
 +{
 +  char *ptr;
 +  size_t max_length= strlen(from);
 +  if (length > max_length)
 +    length= max_length;
 +  if ((ptr= (char*) malloc(length+1)) != 0)
 +  {
 +    memcpy((char*) ptr, (char*) from, length);
 +    ptr[length]=0;
 +  }
 +  return ptr;
 +}
 +#endif
 +
 +#ifndef DBUG_OFF
 +static char pam_debug = 0;
 +#define PAM_DEBUG(X)   do { if (pam_debug) { fprintf X; } } while(0)
 +#else
 +#define PAM_DEBUG(X)   /* no-op */
 +#endif
 +
++static char winbind_hack = 0;
++
 +static int conv(int n, const struct pam_message **msg,
 +                struct pam_response **resp, void *data)
 +{
 +  struct param *param = (struct param *)data;
 +  unsigned char *end = param->buf + sizeof(param->buf) - 1;
 +  int i;
 +
 +  *resp = 0;
 +
 +  for (i = 0; i < n; i++)
 +  {
 +    /* if there's a message - append it to the buffer */
 +    if (msg[i]->msg)
 +    {
 +      int len = strlen(msg[i]->msg);
 +      if (len > end - param->ptr)
 +        len = end - param->ptr;
 +      if (len > 0)
 +      {
 +        memcpy(param->ptr, msg[i]->msg, len);
 +        param->ptr+= len;
 +        *(param->ptr)++ = '\n';
 +      }
 +    }
 +    /* if the message style is *_PROMPT_*, meaning PAM asks a question,
 +       send the accumulated text to the client, read the reply */
 +    if (msg[i]->msg_style == PAM_PROMPT_ECHO_OFF ||
 +        msg[i]->msg_style == PAM_PROMPT_ECHO_ON)
 +    {
 +      int pkt_len;
 +      unsigned char *pkt;
 +
 +      /* allocate the response array.
 +         freeing it is the responsibility of the caller */
 +      if (*resp == 0)
 +      {
 +        *resp = calloc(sizeof(struct pam_response), n);
 +        if (*resp == 0)
 +          return PAM_BUF_ERR;
 +      }
 +
 +      /* dialog plugin interprets the first byte of the packet
 +         as the magic number.
 +           2 means "read the input with the echo enabled"
 +           4 means "password-like input, echo disabled"
 +         C'est la vie. */
 +      param->buf[0] = msg[i]->msg_style == PAM_PROMPT_ECHO_ON ? 2 : 4;
 +      PAM_DEBUG((stderr, "PAM: conv: send(%.*s)\n",
 +                (int)(param->ptr - param->buf - 1), param->buf));
 +      pkt_len= roundtrip(param, param->buf, param->ptr - param->buf - 1, &pkt);
 +      if (pkt_len < 0)
 +        return PAM_CONV_ERR;
 +
 +      PAM_DEBUG((stderr, "PAM: conv: recv(%.*s)\n", pkt_len, pkt));
 +      /* allocate and copy the reply to the response array */
 +      if (!((*resp)[i].resp= strndup((char*) pkt, pkt_len)))
 +        return PAM_CONV_ERR;
 +      param->ptr = param->buf + 1;
 +    }
 +  }
 +  return PAM_SUCCESS;
 +}
 +
 +#define DO(X) if ((status = (X)) != PAM_SUCCESS) goto end
 +
 +#if defined(SOLARIS) || defined(__sun)
 +typedef void** pam_get_item_3_arg;
 +#else
 +typedef const void** pam_get_item_3_arg;
 +#endif
 +
 +static int pam_auth_base(struct param *param, MYSQL_SERVER_AUTH_INFO *info)
 +{
 +  pam_handle_t *pamh = NULL;
 +  int status;
 +  const char *new_username= NULL;
 +  /* The following is written in such a way to make also solaris happy */
 +  struct pam_conv pam_start_arg = { &conv, (char*) param };
 +
 +  /*
 +    get the service name, as specified in
 +
 +     CREATE USER ... IDENTIFIED WITH pam AS "service"
 +  */
 +  const char *service = info->auth_string && info->auth_string[0]
 +                          ? info->auth_string : "mysql";
 +
 +  param->ptr = param->buf + 1;
 +
 +  PAM_DEBUG((stderr, "PAM: pam_start(%s, %s)\n", service, info->user_name));
 +  DO( pam_start(service, info->user_name, &pam_start_arg, &pamh) );
 +
 +  PAM_DEBUG((stderr, "PAM: pam_authenticate(0)\n"));
 +  DO( pam_authenticate (pamh, 0) );
 +
 +  PAM_DEBUG((stderr, "PAM: pam_acct_mgmt(0)\n"));
 +  DO( pam_acct_mgmt(pamh, 0) );
 +
 +  PAM_DEBUG((stderr, "PAM: pam_get_item(PAM_USER)\n"));
 +  DO( pam_get_item(pamh, PAM_USER, (pam_get_item_3_arg) &new_username) );
 +
-   if (new_username && strcmp(new_username, info->user_name))
++  if (new_username &&
++      (winbind_hack ? strcasecmp : strcmp)(new_username, info->user_name))
 +    strncpy(info->authenticated_as, new_username,
 +            sizeof(info->authenticated_as));
 +  info->authenticated_as[sizeof(info->authenticated_as)-1]= 0;
 +
 +end:
 +  pam_end(pamh, status);
 +  PAM_DEBUG((stderr, "PAM: status = %d user = %s\n", status, info->authenticated_as));
 +  return status == PAM_SUCCESS ? CR_OK : CR_ERROR;
 +}
 +
diff --cc plugin/auth_pam/auth_pam_common.c
index 135feb611a6,00000000000..ef8f0f658ff
mode 100644,000000..100644
--- a/plugin/auth_pam/auth_pam_common.c
+++ b/plugin/auth_pam/auth_pam_common.c
@@@ -1,51 -1,0 +1,56 @@@
 +/*
 +   Copyright (c) 2011, 2018 MariaDB Corporation
 +
 +   This program is free software; you can redistribute it and/or modify
 +   it under the terms of the GNU General Public License as published by
 +   the Free Software Foundation; version 2 of the License.
 +
 +   This program is distributed in the hope that it will be useful,
 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +   GNU General Public License for more details.
 +
 +   You should have received a copy of the GNU General Public License
 +   along with this program; if not, write to the Free Software
 +   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
 +
 +/*
 +  In this file we gather the plugin interface definitions
 +  that are same in all the PAM plugin versions.
 +  To be included into auth_pam.c and auth_pam_v1.c.
 +*/
 +
 +static struct st_mysql_auth info =
 +{
 +  MYSQL_AUTHENTICATION_INTERFACE_VERSION,
 +  "dialog",
 +  pam_auth,
 +  NULL, NULL /* no PASSWORD() */
 +};
 +
 +static char use_cleartext_plugin;
 +static MYSQL_SYSVAR_BOOL(use_cleartext_plugin, use_cleartext_plugin,
 +       PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
 +       "Use mysql_cleartext_plugin on the client side instead of the dialog "
 +       "plugin. This may be needed for compatibility reasons, but it only "
 +       "supports simple PAM policies that don't require anything besides "
 +       "a password", NULL, NULL, 0);
 +
++static MYSQL_SYSVAR_BOOL(winbind_workaround, winbind_hack, PLUGIN_VAR_OPCMDARG,
++       "Compare usernames case insensitively to work around pam_winbind "
++       "unconditional username lowercasing", NULL, NULL, 0);
++
 +#ifndef DBUG_OFF
 +static MYSQL_SYSVAR_BOOL(debug, pam_debug, PLUGIN_VAR_OPCMDARG,
 +       "Log all PAM activity", NULL, NULL, 0);
 +#endif
 +
 +
 +static struct st_mysql_sys_var* vars[] = {
 +  MYSQL_SYSVAR(use_cleartext_plugin),
++  MYSQL_SYSVAR(winbind_workaround),
 +#ifndef DBUG_OFF
 +  MYSQL_SYSVAR(debug),
 +#endif
 +  NULL
 +};
diff --cc plugin/auth_pam/auth_pam_tool.c
index 95d47dca113,00000000000..6fd30b457ee
mode 100644,000000..100644
--- a/plugin/auth_pam/auth_pam_tool.c
+++ b/plugin/auth_pam/auth_pam_tool.c
@@@ -1,115 -1,0 +1,116 @@@
 +/*
 +   Copyright (c) 2011, 2018 MariaDB Corporation
 +
 +   This program is free software; you can redistribute it and/or modify
 +   it under the terms of the GNU General Public License as published by
 +   the Free Software Foundation; version 2 of the License.
 +
 +   This program is distributed in the hope that it will be useful,
 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +   GNU General Public License for more details.
 +
 +   You should have received a copy of the GNU General Public License
 +   along with this program; if not, write to the Free Software
 +   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
 +
 +#include <stdlib.h>
 +#include <unistd.h>
 +#include <mysql/plugin_auth_common.h>
 +
 +struct param {
 +  unsigned char buf[10240], *ptr;
 +};
 +
 +
 +#include "auth_pam_tool.h"
 +
 +
 +static int roundtrip(struct param *param, const unsigned char *buf,
 +                     int buf_len, unsigned char **pkt)
 +{
 +  unsigned char b=  AP_CONV;
 +  if (write(1, &b, 1) < 1 || write_string(1, buf, buf_len))
 +    return -1;
 +  *pkt= (unsigned char *) param->buf;
 +  return read_string(0, (char *) param->buf, (int) sizeof(param->buf)) - 1;
 +}
 +
 +typedef struct st_mysql_server_auth_info
 +{
 +  /**
 +    User name as sent by the client and shown in USER().
 +    NULL if the client packet with the user name was not received yet.
 +  */
 +  char *user_name;
 +
 +  /**
 +    A corresponding column value from the mysql.user table for the
 +    matching account name
 +  */
 +  char *auth_string;
 +
 +  /**
 +    Matching account name as found in the mysql.user table.
 +    A plugin can override it with another name that will be
 +    used by MySQL for authorization, and shown in CURRENT_USER()
 +  */
 +  char authenticated_as[MYSQL_USERNAME_LENGTH+1]; 
 +} MYSQL_SERVER_AUTH_INFO;
 +
 +
 +#include "auth_pam_base.c"
 +
 +
 +int main(int argc, char **argv)
 +{
 +  struct param param;
 +  MYSQL_SERVER_AUTH_INFO info;
 +  unsigned char field;
 +  int res;
 +  char a_buf[MYSQL_USERNAME_LENGTH + 1 + 1024];
 +
 +  if (read(0, &field, 1) < 1)
 +    return -1;
 +#ifndef DBUG_OFF
-   pam_debug= field;
++  pam_debug= field & 1;
 +#endif
++  winbind_hack= field & 2;
 +  
 +  PAM_DEBUG((stderr, "PAM: sandbox started [%s].\n", argv[0]));
 +
 +  info.user_name= a_buf;
 +  if ((res= read_string(0, info.user_name, sizeof(a_buf))) < 0)
 +    return -1;
 +  PAM_DEBUG((stderr, "PAM: sandbox username [%s].\n", info.user_name));
 +
 +  info.auth_string= info.user_name + res + 1;
 +  if (read_string(0, info.auth_string, sizeof(a_buf) - 1 - res) < 0)
 +    return -1;
 +
 +  PAM_DEBUG((stderr, "PAM: sandbox auth string [%s].\n", info.auth_string));
 +
 +  if ((res= pam_auth_base(&param, &info)) != CR_OK)
 +  {
 +    PAM_DEBUG((stderr, "PAM: auth failed, sandbox closed.\n"));
 +    return -1;
 +  }
 +
 +  if (info.authenticated_as[0])
 +  {
 +    PAM_DEBUG((stderr, "PAM: send authenticated_as field.\n"));
 +    field= AP_AUTHENTICATED_AS;
 +    if (write(1, &field, 1) < 1 ||
 +        write_string(1, (unsigned char *) info.authenticated_as,
 +                     strlen(info.authenticated_as)))
 +      return -1;
 +  }
 +  
 +  PAM_DEBUG((stderr, "PAM: send OK result.\n"));
 +  field= AP_EOF;
 +  if (write(1, &field, 1) != 1)
 +    return -1;
 +
 +  PAM_DEBUG((stderr, "PAM: sandbox closed.\n"));
 +  return 0;
 +}
diff --cc scripts/mysql_install_db.sh
index d87c0aa48a5,d315248ce9c..1ea1e39be36
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@@ -515,13 -487,9 +515,14 @@@ mysqld_install_cmd_line(
    --net_buffer_length=16K
  }
  
 +# Use $auth_root_socket_user if explicitly specified.
 +# Otherwise use the owner of datadir - ${user:-$USER}
 +# Use 'root' as a fallback
 +auth_root_socket_user=${auth_root_socket_user:-${user:-${USER:-root}}}
 +
  cat_sql()
  {
+   echo "create database if not exists mysql;"
    echo "use mysql;"
  
    case "$auth_root_authentication_method" in
diff --cc sql/events.cc
index 196c8df591d,d8c4f373582..166fa992f88
--- a/sql/events.cc
+++ b/sql/events.cc
@@@ -418,11 -418,17 +418,17 @@@ Events::create_event(THD *thd, Event_pa
  
    thd->restore_stmt_binlog_format(save_binlog_format);
  
+   if (!ret && Events::opt_event_scheduler == Events::EVENTS_OFF)
+   {
+     push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, 
+       "Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.");
+   }
+ 
    DBUG_RETURN(ret);
 -
 -WSREP_ERROR_LABEL:
 -  DBUG_RETURN(TRUE);
 -
 +#ifdef WITH_WSREP
 +wsrep_error_label:
 +  DBUG_RETURN(true);
 +#endif
  }
  
  
diff --cc sql/field.cc
index 4256ef70005,c6bdb013cdf..a671195ba2b
--- a/sql/field.cc
+++ b/sql/field.cc
@@@ -4544,13 -4554,10 +4544,10 @@@ longlong Field_float::val_int(void
  String *Field_float::val_str(String *val_buffer,
  			     String *val_ptr __attribute__((unused)))
  {
 -  ASSERT_COLUMN_MARKED_FOR_READ;
 +  DBUG_ASSERT(marked_for_read());
    DBUG_ASSERT(!zerofill || field_length <= MAX_FIELD_CHARLENGTH);
-   float nr;
-   float4get(nr,ptr);
  
-   uint to_length= 70;
-   if (val_buffer->alloc(to_length))
+   if (Float(ptr).to_string(val_buffer, dec))
    {
      my_error(ER_OUT_OF_RESOURCES, MYF(0));
      return val_buffer;
diff --cc sql/handler.cc
index edd6e40b8ec,826b6f34746..c5d6fa29f8f
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@@ -5023,6 -4998,98 +5020,98 @@@ end
  }
  
  
+ static void flush_checksum(ha_checksum *row_crc, uchar **checksum_start,
+                            size_t *checksum_length)
+ {
+   if (*checksum_start)
+   {
+     *row_crc= my_checksum(*row_crc, *checksum_start, *checksum_length);
+     *checksum_start= NULL;
+     *checksum_length= 0;
+   }
+ }
+ 
+ 
+ /* calculating table's checksum */
+ int handler::calculate_checksum()
+ {
+   int error;
+   THD *thd=ha_thd();
+   DBUG_ASSERT(table->s->last_null_bit_pos < 8);
+   uchar null_mask= table->s->last_null_bit_pos
+                    ? 256 -  (1 << table->s->last_null_bit_pos) : 0;
+ 
 -  table->use_all_columns();
++  table->use_all_stored_columns();
+   stats.checksum= 0;
+ 
+   if ((error= ha_rnd_init(1)))
+     return error;
+ 
+   for (;;)
+   {
+     if (thd->killed)
+       return HA_ERR_ABORTED_BY_USER;
+ 
+     ha_checksum row_crc= 0;
+     error= table->file->ha_rnd_next(table->record[0]);
+     if (error)
+       break;
+ 
+     if (table->s->null_bytes)
+     {
+       /* fix undefined null bits */
+       table->record[0][table->s->null_bytes-1] |= null_mask;
+       if (!(table->s->db_create_options & HA_OPTION_PACK_RECORD))
+         table->record[0][0] |= 1;
+ 
+       row_crc= my_checksum(row_crc, table->record[0], table->s->null_bytes);
+     }
+ 
+     uchar *checksum_start= NULL;
+     size_t checksum_length= 0;
+     for (uint i= 0; i < table->s->fields; i++ )
+     {
+       Field *f= table->field[i];
+ 
+       if (! thd->variables.old_mode && f->is_real_null(0))
+       {
+         flush_checksum(&row_crc, &checksum_start, &checksum_length);
+         continue;
+       }
+      /*
+        BLOB and VARCHAR have pointers in their field, we must convert
+        to string; GEOMETRY is implemented on top of BLOB.
+        BIT may store its data among NULL bits, convert as well.
+      */
+       switch (f->type()) {
+         case MYSQL_TYPE_BLOB:
+         case MYSQL_TYPE_VARCHAR:
+         case MYSQL_TYPE_GEOMETRY:
+         case MYSQL_TYPE_BIT:
+         {
+           flush_checksum(&row_crc, &checksum_start, &checksum_length);
+           String tmp;
+           f->val_str(&tmp);
+           row_crc= my_checksum(row_crc, (uchar*) tmp.ptr(), tmp.length());
+           break;
+         }
+         default:
+           if (!checksum_start)
+             checksum_start= f->ptr;
+           DBUG_ASSERT(checksum_start + checksum_length == f->ptr);
+           checksum_length+= f->pack_length();
+           break;
+       }
+     }
+     flush_checksum(&row_crc, &checksum_start, &checksum_length);
+ 
+     stats.checksum+= row_crc;
+   }
+   table->file->ha_rnd_end();
+   return error == HA_ERR_END_OF_FILE ? 0 : error;
+ }
+ 
+ 
  /****************************************************************************
  ** Some general functions that isn't in the handler class
  ****************************************************************************/
@@@ -7561,175 -7471,44 +7688,148 @@@ bool Vers_parse_info::check_sys_fields(
    if (check_conditions(table_name, db))
      return true;
  
+   const Create_field *row_start= NULL;
+   const Create_field *row_end= NULL;
+ 
    List_iterator<Create_field> it(alter_info->create_list);
-   uint found_flag= 0;
    while (Create_field *f= it++)
    {
-     vers_sys_type_t f_check_unit= VERS_UNDEFINED;
-     uint sys_flag= f->flags & VERS_SYSTEM_FIELD;
+     if (!row_start && f->flags & VERS_SYS_START_FLAG)
+       row_start= f;
+     else if (!row_end && f->flags & VERS_SYS_END_FLAG)
+       row_end= f;
+   }
  
-     if (!sys_flag)
-       continue;
+   const bool expect_timestamp=
+       !can_native || !is_some_bigint(row_start) || !is_some_bigint(row_end);
  
-     if (sys_flag & found_flag)
-     {
-       my_error(ER_VERS_DUPLICATE_ROW_START_END, MYF(0),
-                 found_flag & VERS_SYS_START_FLAG ? "START" : "END",
-                f->field_name.str);
-       return true;
-     }
+   if (expect_timestamp)
+   {
+     if (!is_versioning_timestamp(row_start))
+       return require_timestamp(row_start, table_name);
  
-     sys_flag|= found_flag;
+     if (!is_versioning_timestamp(row_end))
+       return require_timestamp(row_end, table_name);
+   }
+   else
+   {
+     if (!is_versioning_bigint(row_start))
+       return require_bigint(row_start, table_name);
  
-     if ((f->type_handler() == &type_handler_datetime2 ||
-           f->type_handler() == &type_handler_timestamp2) &&
-         f->length == MAX_DATETIME_FULL_WIDTH)
-     {
-       f_check_unit= VERS_TIMESTAMP;
-     }
-     else if (f->type_handler() == &type_handler_longlong
-       && (f->flags & UNSIGNED_FLAG)
-       && f->length == (MY_INT64_NUM_DECIMAL_DIGITS - 1))
-     {
-       f_check_unit= VERS_TRX_ID;
-     }
-     else
-     {
-       if (!check_unit)
-         check_unit= VERS_TIMESTAMP;
-       goto error;
-     }
+     if (!is_versioning_bigint(row_end))
+       return require_bigint(row_end, table_name);
+   }
  
-     if (f_check_unit)
-     {
-       if (check_unit)
-       {
-         if (check_unit == f_check_unit)
-         {
-           if (check_unit == VERS_TRX_ID && !TR_table::use_transaction_registry)
-           {
-             my_error(ER_VERS_TRT_IS_DISABLED, MYF(0));
-             return true;
-           }
-           return false;
-         }
-       error:
-         my_error(ER_VERS_FIELD_WRONG_TYPE, MYF(0), f->field_name.str,
-                  check_unit == VERS_TIMESTAMP ?
-                  "TIMESTAMP(6)" :
-                  "BIGINT(20) UNSIGNED",
-                  table_name.str);
-         return true;
-       }
-       check_unit= f_check_unit;
-     }
+   if (is_versioning_bigint(row_start) && is_versioning_bigint(row_end) &&
+       !TR_table::use_transaction_registry)
+   {
+     my_error(ER_VERS_TRT_IS_DISABLED, MYF(0));
+     return true;
    }
  
-   my_error(ER_MISSING, MYF(0), table_name.str, found_flag & VERS_SYS_START_FLAG ?
-            "ROW END" : found_flag ? "ROW START" : "ROW START/END");
-   return true;
+   return false;
  }
 +
 +bool Table_period_info::check_field(const Create_field* f,
 +                                    const Lex_ident& f_name) const
 +{
 +  bool res= false;
 +  if (!f)
 +  {
 +    my_error(ER_BAD_FIELD_ERROR, MYF(0), f_name.str, name.str);
 +    res= true;
 +  }
 +  else if (f->type_handler()->mysql_timestamp_type() != MYSQL_TIMESTAMP_DATE &&
 +           f->type_handler()->mysql_timestamp_type() != MYSQL_TIMESTAMP_DATETIME)
 +  {
 +    my_error(ER_WRONG_FIELD_SPEC, MYF(0), f->field_name.str);
 +    res= true;
 +  }
 +  else if (f->vcol_info || f->flags & VERS_SYSTEM_FIELD)
 +  {
 +    my_error(ER_PERIOD_FIELD_WRONG_ATTRIBUTES, MYF(0),
 +             f->field_name.str, "GENERATED ALWAYS AS");
 +  }
 +
 +  return res;
 +}
 +
 +bool Table_scope_and_contents_source_st::check_fields(
 +  THD *thd, Alter_info *alter_info, TABLE_LIST &create_table)
 +{
 +  return vers_check_system_fields(thd, alter_info, create_table)
 +         || check_period_fields(thd, alter_info);
 +}
 +
 +bool Table_scope_and_contents_source_st::check_period_fields(
 +                THD *thd, Alter_info *alter_info)
 +{
 +  if (!period_info.name)
 +    return false;
 +
 +  if (tmp_table())
 +  {
 +    my_error(ER_PERIOD_TEMPORARY_NOT_ALLOWED, MYF(0));
 +    return true;
 +  }
 +
 +  Table_period_info::start_end_t &period= period_info.period;
 +  const Create_field *row_start= NULL;
 +  const Create_field *row_end= NULL;
 +  List_iterator<Create_field> it(alter_info->create_list);
 +  while (const Create_field *f= it++)
 +  {
 +    if (period.start.streq(f->field_name)) row_start= f;
 +    else if (period.end.streq(f->field_name)) row_end= f;
 +
 +    if (period_info.name.streq(f->field_name))
 +    {
 +      my_error(ER_DUP_FIELDNAME, MYF(0), f->field_name.str);
 +      return true;
 +    }
 +  }
 +
 +  bool res= period_info.check_field(row_start, period.start.str)
 +            || period_info.check_field(row_end, period.end.str);
 +  if (res)
 +    return true;
 +
 +  if (row_start->type_handler() != row_end->type_handler()
 +      || row_start->length != row_end->length)
 +  {
 +    my_error(ER_PERIOD_TYPES_MISMATCH, MYF(0), period_info.name.str);
 +    res= true;
 +  }
 +
 +  return res;
 +}
 +
 +bool
 +Table_scope_and_contents_source_st::fix_create_fields(THD *thd,
 +                                                      Alter_info *alter_info,
 +                                                      const TABLE_LIST &create_table,
 +                                                      bool create_select)
 +{
 +  return vers_fix_system_fields(thd, alter_info, create_table, create_select)
 +         || fix_period_fields(thd, alter_info);
 +}
 +
 +bool
 +Table_scope_and_contents_source_st::fix_period_fields(THD *thd,
 +                                                      Alter_info *alter_info)
 +{
 +  if (!period_info.name)
 +    return false;
 +
 +  Table_period_info::start_end_t &period= period_info.period;
 +  List_iterator<Create_field> it(alter_info->create_list);
 +  while (Create_field *f= it++)
 +  {
 +    if (period.start.streq(f->field_name) || period.end.streq(f->field_name))
 +    {
 +      f->period= &period_info;
 +      f->flags|= NOT_NULL_FLAG;
 +    }
 +  }
 +  return false;
 +}
diff --cc sql/handler.h
index fb6862e4ce1,7d3017d4a12..d030a73c76f
--- a/sql/handler.h
+++ b/sql/handler.h
@@@ -1986,35 -1946,15 +1986,33 @@@ struct Table_period_info: Sql_allo
      Lex_ident start;
      Lex_ident end;
    };
 +  start_end_t period;
 +  bool create_if_not_exists;
 +  Virtual_column_info *constr;
  
 -  start_end_t system_time;
 -  start_end_t as_row;
 +  bool is_set() const
 +  {
 +    DBUG_ASSERT(bool(period.start) == bool(period.end));
 +    return period.start;
 +  }
  
 -  void set_system_time(Lex_ident start, Lex_ident end)
 +  void set_period(const Lex_ident& start, const Lex_ident& end)
    {
 -    system_time.start= start;
 -    system_time.end= end;
 +    period.start= start;
 +    period.end= end;
    }
 +  bool check_field(const Create_field* f, const Lex_ident& f_name) const;
 +};
 +
 +struct Vers_parse_info: public Table_period_info
 +{
 +  Vers_parse_info() :
 +    Table_period_info(STRING_WITH_LEN("SYSTEM_TIME")),
-     check_unit(VERS_UNDEFINED),
 +    versioned_fields(false),
 +    unversioned_fields(false)
 +  {}
 +
 +  Table_period_info::start_end_t as_row;
-   vers_sys_type_t check_unit;
  
  protected:
    friend struct Table_scope_and_contents_source_st;
diff --cc sql/item.cc
index 7d901c3333d,3584230fb2a..22bcbf39ab3
--- a/sql/item.cc
+++ b/sql/item.cc
@@@ -9963,8 -10153,9 +9963,8 @@@ longlong Item_cache_real::val_int(
  }
  
  
- String* Item_cache_real::val_str(String *str)
+ String* Item_cache_double::val_str(String *str)
  {
 -  DBUG_ASSERT(fixed == 1);
    if (!has_value())
      return NULL;
    str->set_real(value, decimals, default_charset());
@@@ -9972,8 -10163,19 +9972,17 @@@
  }
  
  
+ String* Item_cache_float::val_str(String *str)
+ {
 -  DBUG_ASSERT(fixed == 1);
+   if (!has_value())
+     return NULL;
+   Float(value).to_string(str, decimals);
+   return str;
+ }
+ 
+ 
  my_decimal *Item_cache_real::val_decimal(my_decimal *decimal_val)
  {
 -  DBUG_ASSERT(fixed == 1);
    if (!has_value())
      return NULL;
    double2my_decimal(E_DEC_FATAL_ERROR, value, decimal_val);
diff --cc sql/item.h
index 0c6465f98f6,2adc111db03..b0d3666ead7
--- a/sql/item.h
+++ b/sql/item.h
@@@ -6782,21 -6186,44 +6782,44 @@@ public
  
  class Item_cache_real: public Item_cache
  {
+ protected:
    double value;
  public:
-   Item_cache_real(THD *thd): Item_cache(thd, &type_handler_double),
-     value(0) {}
- 
+   Item_cache_real(THD *thd, const Type_handler *h)
+    :Item_cache(thd, h),
+     value(0)
+   {}
    double val_real();
    longlong val_int();
-   String* val_str(String *str);
    my_decimal *val_decimal(my_decimal *);
 -  bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
 -  { return get_date_from_real(ltime, fuzzydate); }
 +  bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
 +  { return get_date_from_real(thd, ltime, fuzzydate); }
    bool cache_value();
    Item *convert_to_basic_const_item(THD *thd);
+ };
+ 
+ 
+ class Item_cache_double: public Item_cache_real
+ {
+ public:
+   Item_cache_double(THD *thd)
+    :Item_cache_real(thd, &type_handler_double)
+   { }
+   String* val_str(String *str);
+   Item *get_copy(THD *thd)
+   { return get_item_copy<Item_cache_double>(thd, this); }
+ };
+ 
+ 
+ class Item_cache_float: public Item_cache_real
+ {
+ public:
+   Item_cache_float(THD *thd)
+    :Item_cache_real(thd, &type_handler_float)
+   { }
+   String* val_str(String *str);
    Item *get_copy(THD *thd)
-   { return get_item_copy<Item_cache_real>(thd, this); }
+   { return get_item_copy<Item_cache_float>(thd, this); }
  };
  
  
diff --cc sql/item_jsonfunc.cc
index 40237ab46a6,2f43f907c8b..a90e7fb3a1a
--- a/sql/item_jsonfunc.cc
+++ b/sql/item_jsonfunc.cc
@@@ -2135,6 -2141,331 +2135,331 @@@ String *Item_func_json_merge::val_str(S
    null_value= 0;
    return str;
  
+ error_return:
+   if (je1.s.error)
+     report_json_error(js1, &je1, 0);
+   if (je2.s.error)
+     report_json_error(js2, &je2, n_arg);
+ null_return:
+   null_value= 1;
+   return NULL;
+ }
+ 
+ 
+ static int copy_value_patch(String *str, json_engine_t *je)
+ {
+   int first_key= 1;
+ 
+   if (je->value_type != JSON_VALUE_OBJECT)
+   {
+     const uchar *beg, *end;
+ 
+     beg= je->value_begin;
+ 
+     if (!json_value_scalar(je))
+     {
+       if (json_skip_level(je))
+         return 1;
+       end= je->s.c_str;
+     }
+     else
+       end= je->value_end;
+ 
+     if (append_simple(str, beg, end-beg))
+       return 1;
+ 
+     return 0;
+   }
+   /* JSON_VALUE_OBJECT */
+ 
+   if (str->append("{", 1))
+     return 1;
+   while (json_scan_next(je) == 0 && je->state != JST_OBJ_END)
+   {
+     const uchar *key_start;
+     /* Loop through the Json_1 keys and compare with the Json_2 keys. */
+     DBUG_ASSERT(je->state == JST_KEY);
+     key_start= je->s.c_str;
+ 
+     if (json_read_value(je))
+       return 1;
+ 
+     if (je->value_type == JSON_VALUE_NULL)
+       continue;
+ 
+     if (!first_key)
+     {
+       if (str->append(", ", 2))
+         return 3;
+     }
+     else
+       first_key= 0;
+ 
+     if (str->append("\"", 1) ||
+         append_simple(str, key_start, je->value_begin - key_start) ||
+         copy_value_patch(str, je))
+       return 1;
+   }
+   if (str->append("}", 1))
+     return 1;
+ 
+   return 0;
+ }
+ 
+ 
+ static int do_merge_patch(String *str, json_engine_t *je1, json_engine_t *je2,
+                           bool *empty_result)
+ {
+   if (json_read_value(je1) || json_read_value(je2))
+     return 1;
+ 
+   if (je1->value_type == JSON_VALUE_OBJECT &&
+       je2->value_type == JSON_VALUE_OBJECT)
+   {
+     json_engine_t sav_je1= *je1;
+     json_engine_t sav_je2= *je2;
+ 
+     int first_key= 1;
+     json_string_t key_name;
+     size_t sav_len;
+     bool mrg_empty;
 -  
++
+     *empty_result= FALSE;
+     json_string_set_cs(&key_name, je1->s.cs);
+ 
+     if (str->append("{", 1))
+       return 3;
+     while (json_scan_next(je1) == 0 &&
+            je1->state != JST_OBJ_END)
+     {
+       const uchar *key_start, *key_end;
+       /* Loop through the Json_1 keys and compare with the Json_2 keys. */
+       DBUG_ASSERT(je1->state == JST_KEY);
+       key_start= je1->s.c_str;
+       do
+       {
+         key_end= je1->s.c_str;
+       } while (json_read_keyname_chr(je1) == 0);
+ 
+       if (je1->s.error)
+         return 1;
+ 
+       sav_len= str->length();
+ 
+       if (!first_key)
+       {
+         if (str->append(", ", 2))
+           return 3;
+         *je2= sav_je2;
+       }
+ 
+       if (str->append("\"", 1) ||
+           append_simple(str, key_start, key_end - key_start) ||
+           str->append("\":", 2))
+         return 3;
+ 
+       while (json_scan_next(je2) == 0 &&
+           je2->state != JST_OBJ_END)
+       {
+         int ires;
+         DBUG_ASSERT(je2->state == JST_KEY);
+         json_string_set_str(&key_name, key_start, key_end);
+         if (!json_key_matches(je2, &key_name))
+         {
+           if (je2->s.error || json_skip_key(je2))
+             return 2;
+           continue;
+         }
+ 
+         /* Json_2 has same key as Json_1. Merge them. */
+         if ((ires= do_merge_patch(str, je1, je2, &mrg_empty)))
+           return ires;
+ 
+         if (mrg_empty)
+           str->length(sav_len);
+         else
+           first_key= 0;
+ 
+         goto merged_j1;
+       }
+ 
+       if (je2->s.error)
+         return 2;
+ 
+       key_start= je1->s.c_str;
+       /* Just append the Json_1 key value. */
+       if (json_skip_key(je1))
+         return 1;
+       if (append_simple(str, key_start, je1->s.c_str - key_start))
+         return 3;
+       first_key= 0;
+ 
+ merged_j1:
+       continue;
+     }
+ 
+     *je2= sav_je2;
+     /*
+       Now loop through the Json_2 keys.
+       Skip if there is same key in Json_1
+     */
+     while (json_scan_next(je2) == 0 &&
+            je2->state != JST_OBJ_END)
+     {
+       const uchar *key_start, *key_end;
+       DBUG_ASSERT(je2->state == JST_KEY);
+       key_start= je2->s.c_str;
+       do
+       {
+         key_end= je2->s.c_str;
+       } while (json_read_keyname_chr(je2) == 0);
+ 
+       if (je2->s.error)
+         return 1;
+ 
+       *je1= sav_je1;
+       while (json_scan_next(je1) == 0 &&
+              je1->state != JST_OBJ_END)
+       {
+         DBUG_ASSERT(je1->state == JST_KEY);
+         json_string_set_str(&key_name, key_start, key_end);
+         if (!json_key_matches(je1, &key_name))
+         {
+           if (je1->s.error || json_skip_key(je1))
+             return 2;
+           continue;
+         }
+         if (json_skip_key(je2) ||
+             json_skip_level(je1))
+           return 1;
+         goto continue_j2;
+       }
+ 
+       if (je1->s.error)
+         return 2;
+ 
+ 
+       sav_len= str->length();
+ 
+       if (!first_key && str->append(", ", 2))
+         return 3;
+ 
+       if (str->append("\"", 1) ||
+           append_simple(str, key_start, key_end - key_start) ||
+           str->append("\":", 2))
+         return 3;
+ 
+       if (json_read_value(je2))
+         return 1;
+ 
+       if (je2->value_type == JSON_VALUE_NULL)
+         str->length(sav_len);
+       else
+       {
+         if (copy_value_patch(str, je2))
+           return 1;
+         first_key= 0;
+       }
+ 
+ continue_j2:
+       continue;
+     }
+ 
+     if (str->append("}", 1))
+       return 3;
+   }
+   else
+   {
+     if (!json_value_scalar(je1) && json_skip_level(je1))
+       return 1;
+ 
+     *empty_result= je2->value_type == JSON_VALUE_NULL;
+     if (!(*empty_result) && copy_value_patch(str, je2))
+       return 1;
+   }
+ 
+   return 0;
+ }
+ 
+ 
+ String *Item_func_json_merge_patch::val_str(String *str)
+ {
+   DBUG_ASSERT(fixed == 1);
+   json_engine_t je1, je2;
+   String *js1= args[0]->val_json(&tmp_js1), *js2=NULL;
+   uint n_arg;
+   bool empty_result, merge_to_null;
+ 
+   merge_to_null= args[0]->null_value;
+ 
+   for (n_arg=1; n_arg < arg_count; n_arg++)
+   {
+     js2= args[n_arg]->val_json(&tmp_js2);
+     if (args[n_arg]->null_value)
+     {
+       merge_to_null= true;
+       goto cont_point;
+     }
+ 
+     json_scan_start(&je2, js2->charset(),(const uchar *) js2->ptr(),
+                     (const uchar *) js2->ptr() + js2->length());
+ 
+     if (merge_to_null)
+     {
+       if (json_read_value(&je2))
+         goto error_return;
+       if (je2.value_type == JSON_VALUE_OBJECT)
+       {
+         merge_to_null= true;
+         goto cont_point;
+       }
+       merge_to_null= false;
+       str->set(js2->ptr(), js2->length(), js2->charset());
+       goto cont_point;
+     }
+ 
+     str->set_charset(js1->charset());
+     str->length(0);
+ 
+ 
+     json_scan_start(&je1, js1->charset(),(const uchar *) js1->ptr(),
+                     (const uchar *) js1->ptr() + js1->length());
+ 
+     if (do_merge_patch(str, &je1, &je2, &empty_result))
+       goto error_return;
+ 
+     if (empty_result)
+       str->append("null");
+ 
+ cont_point:
+     {
+       /* Swap str and js1. */
+       if (str == &tmp_js1)
+       {
+         str= js1;
+         js1= &tmp_js1;
+       }
+       else
+       {
+         js1= str;
+         str= &tmp_js1;
+       }
+     }
+   }
+ 
+   if (merge_to_null)
+     goto null_return;
+ 
+   json_scan_start(&je1, js1->charset(),(const uchar *) js1->ptr(),
+                   (const uchar *) js1->ptr() + js1->length());
+   str->length(0);
+   str->set_charset(js1->charset());
+   if (json_nice(&je1, str, Item_func_json_format::LOOSE))
+     goto error_return;
+ 
+   null_value= 0;
+   return str;
+ 
  error_return:
    if (je1.s.error)
      report_json_error(js1, &je1, 0);
diff --cc sql/item_sum.h
index abe6192fcd1,ef849782464..59b8f824c72
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@@ -1845,14 -1797,9 +1846,17 @@@ class Item_func_group_concat : public I
    friend int dump_leaf_key(void* key_arg,
                             element_count count __attribute__((unused)),
  			   void* item_arg);
+ 
+   bool repack_tree(THD *thd);
+ 
 +public:
 +  // Methods used by ColumnStore
 +  bool get_distinct() const { return distinct; }
 +  uint get_count_field() const { return arg_count_field; }
 +  uint get_order_field() const { return arg_count_order; }
 +  const String* get_separator() const { return separator; }
 +  ORDER** get_order() const { return order; }
 +
  public:
    Item_func_group_concat(THD *thd, Name_resolution_context *context_arg,
                           bool is_distinct, List<Item> *is_select,
diff --cc sql/log_event.cc
index 1246330f7bb,e96e278e6eb..95d602a0d8e
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@@ -11327,15 -11315,15 +11333,15 @@@ int Rows_log_event::do_apply_event(rpl_
        {
          WSREP_WARN("BF applier failed to open_and_lock_tables: %u, fatal: %d "
                     "wsrep = (exec_mode: %d conflict_state: %d seqno: %lld)",
 -		   thd->get_stmt_da()->sql_errno(),
 -                   thd->is_fatal_error,
 -                   thd->wsrep_exec_mode,
 -                   thd->wsrep_conflict_state,
 -                   (long long)wsrep_thd_trx_seqno(thd));
 +                    thd->get_stmt_da()->sql_errno(),
 +                    thd->is_fatal_error,
 +                    thd->wsrep_cs().mode(),
 +                    thd->wsrep_trx().state(),
 +                    (long long) wsrep_thd_trx_seqno(thd));
        }
 -#endif
 +#endif /* WITH_WSREP */
-       if ((thd->is_slave_error || thd->is_fatal_error) &&
-           !is_parallel_retry_error(rgi, actual_error))
+       if (thd->is_error() &&
+           !is_parallel_retry_error(rgi, error= thd->get_stmt_da()->sql_errno()))
        {
          /*
            Error reporting borrowed from Query_log_event with many excessive
diff --cc sql/my_json_writer.h
index 8f86212ac30,da56396d7d9..2c27043e74e
--- a/sql/my_json_writer.h
+++ b/sql/my_json_writer.h
@@@ -11,17 -11,9 +11,17 @@@
  
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
  
 +#ifndef JSON_WRITER_INCLUDED
 +#define JSON_WRITER_INCLUDED
 +#include "my_base.h"
 +#include "sql_select.h"
 +class Opt_trace_stmt;
 +class Opt_trace_context;
  class Json_writer;
 +struct TABLE_LIST;
 +
  
  /*
    Single_line_formatting_helper is used by Json_writer to do better formatting
diff --cc sql/mysqld.cc
index dec23535551,e8c605ce945..403d91b6285
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@@ -7078,7 -7829,8 +7099,6 @@@ struct my_option my_long_options[]
    MYSQL_TO_BE_IMPLEMENTED_OPTION("optimizer-trace-features"),     // OPTIMIZER_TRACE
    MYSQL_TO_BE_IMPLEMENTED_OPTION("optimizer-trace-offset"),       // OPTIMIZER_TRACE
    MYSQL_TO_BE_IMPLEMENTED_OPTION("optimizer-trace-limit"),        // OPTIMIZER_TRACE
-   MYSQL_TO_BE_IMPLEMENTED_OPTION("eq-range-index-dive-limit"),
 -  MYSQL_TO_BE_IMPLEMENTED_OPTION("optimizer-trace-max-mem-size"), // OPTIMIZER_TRACE
    MYSQL_COMPATIBILITY_OPTION("server-id-bits"),
    MYSQL_TO_BE_IMPLEMENTED_OPTION("slave-rows-search-algorithms"), // HAVE_REPLICATION
    MYSQL_TO_BE_IMPLEMENTED_OPTION("slave-allow-batching"),         // HAVE_REPLICATION
diff --cc sql/protocol.cc
index ffed17634c0,84ca4585a12..83b4dc80ae2
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@@ -1225,10 -1205,11 +1225,10 @@@ bool Protocol_text::store_decimal(cons
  bool Protocol_text::store(float from, uint32 decimals, String *buffer)
  {
  #ifndef DBUG_OFF
 -  DBUG_ASSERT(field_types == 0 ||
 -	      field_types[field_pos] == MYSQL_TYPE_FLOAT);
 +  DBUG_ASSERT(valid_handler(field_pos, PROTOCOL_SEND_FLOAT));
    field_pos++;
  #endif
-   buffer->set_real((double) from, decimals, thd->charset());
+   Float(from).to_string(buffer, decimals);
    return net_store_data((uchar*) buffer->ptr(), buffer->length());
  }
  
diff --cc sql/sql_acl.cc
index 27f2a985931,50b09e3b675..49dad4a6e3e
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@@ -848,956 -842,376 +848,963 @@@ class Grant_table_bas
  class User_table: public Grant_table_base
  {
   public:
 -  /* Field getters return NULL if the column is not present in the table.
 -     This is consistent only if the table is in a supported version. We do
 -     not guard against corrupt tables. (yet) */
 -  Field* host() const
 -  { return get_field(0); }
 -  Field* user() const
 -  { return get_field(1); }
 -  Field* password() const
 -  { return have_password() ? NULL : tl.table->field[2]; }
 -  /* Columns after privilege columns. */
 -  Field* ssl_type() const
 -  { return get_field(start_privilege_column + num_privileges()); }
 -  Field* ssl_cipher() const
 -  { return get_field(start_privilege_column + num_privileges() + 1); }
 -  Field* x509_issuer() const
 -  { return get_field(start_privilege_column + num_privileges() + 2); }
 -  Field* x509_subject() const
 -  { return get_field(start_privilege_column + num_privileges() + 3); }
 -  Field* max_questions() const
 -  { return get_field(start_privilege_column + num_privileges() + 4); }
 -  Field* max_updates() const
 -  { return get_field(start_privilege_column + num_privileges() + 5); }
 -  Field* max_connections() const
 -  { return get_field(start_privilege_column + num_privileges() + 6); }
 -  Field* max_user_connections() const
 -  { return get_field(start_privilege_column + num_privileges() + 7); }
 -  Field* plugin() const
 -  { return get_field(start_privilege_column + num_privileges() + 8); }
 -  Field* authentication_string() const
 -  { return get_field(start_privilege_column + num_privileges() + 9); }
 -  Field* password_expired() const
 -  { return get_field(start_privilege_column + num_privileges() + 10); }
 -  Field* is_role() const
 -  { return get_field(start_privilege_column + num_privileges() + 11); }
 -  Field* default_role() const
 -  { return get_field(start_privilege_column + num_privileges() + 12); }
 -  Field* max_statement_time() const
 -  { return get_field(start_privilege_column + num_privileges() + 13); }
 -
 -  /*
 -    Check if a user entry in the user table is marked as being a role entry
 -
 -    IMPLEMENTATION
 -    Access the coresponding column and check the coresponding ENUM of the form
 -    ENUM('N', 'Y')
 -
 -    SYNOPSIS
 -      check_is_role()
 -      form      an open table to read the entry from.
 -                The record should be already read in table->record[0]
 -
 -    RETURN VALUE
 -      TRUE      if the user is marked as a role
 -      FALSE     otherwise
 -  */
 -  bool check_is_role() const
 -  {
 -    /* Table version does not support roles */
 -    if (!is_role())
 -      return false;
 -
 -    return get_YN_as_bool(is_role());
 -  }
 -
 -
 +  bool init_read_record(READ_RECORD* info) const
 +  {
 +    return Grant_table_base::init_read_record(info) || setup_sysvars();
 +  }
 +
 +  virtual LEX_CSTRING& name() const = 0;
 +  virtual int get_auth(THD *, MEM_ROOT *, ACL_USER *u) const= 0;
 +  virtual bool set_auth(const ACL_USER &u) const = 0;
 +  virtual ulong get_access() const = 0;
 +  virtual void set_access(ulong rights, bool revoke) const = 0;
 +
 +  char *get_host(MEM_ROOT *root) const
 +  { return ::get_field(root, m_table->field[0]); }
 +  int set_host(const char *s, size_t l) const
 +  { return m_table->field[0]->store(s, l, system_charset_info); };
 +  char *get_user(MEM_ROOT *root) const
 +  { return ::get_field(root, m_table->field[1]); }
 +  int set_user(const char *s, size_t l) const
 +  { return m_table->field[1]->store(s, l, system_charset_info); };
 +
 +  virtual SSL_type get_ssl_type () const = 0;
 +  virtual int set_ssl_type (SSL_type x) const = 0;
 +  virtual const char* get_ssl_cipher (MEM_ROOT *root) const = 0;
 +  virtual int set_ssl_cipher (const char *s, size_t l) const = 0;
 +  virtual const char* get_x509_issuer (MEM_ROOT *root) const = 0;
 +  virtual int set_x509_issuer (const char *s, size_t l) const = 0;
 +  virtual const char* get_x509_subject (MEM_ROOT *root) const = 0;
 +  virtual int set_x509_subject (const char *s, size_t l) const = 0;
 +  virtual longlong get_max_questions () const = 0;
 +  virtual int set_max_questions (longlong x) const = 0;
 +  virtual longlong get_max_updates () const = 0;
 +  virtual int set_max_updates (longlong x) const = 0;
 +  virtual longlong get_max_connections () const = 0;
 +  virtual int set_max_connections (longlong x) const = 0;
 +  virtual longlong get_max_user_connections () const = 0;
 +  virtual int set_max_user_connections (longlong x) const = 0;
 +  virtual double get_max_statement_time () const = 0;
 +  virtual int set_max_statement_time (double x) const = 0;
 +  virtual bool get_is_role () const = 0;
 +  virtual int set_is_role (bool x) const = 0;
 +  virtual const char* get_default_role (MEM_ROOT *root) const = 0;
 +  virtual int set_default_role (const char *s, size_t l) const = 0;
 +  virtual bool get_account_locked () const = 0;
 +  virtual int set_account_locked (bool x) const = 0;
 +  virtual bool get_password_expired () const = 0;
 +  virtual int set_password_expired (bool x) const = 0;
 +  virtual my_time_t get_password_last_changed () const = 0;
 +  virtual int set_password_last_changed (my_time_t x) const = 0;
 +  virtual longlong get_password_lifetime () const = 0;
 +  virtual int set_password_lifetime (longlong x) const = 0;
 +
 +  virtual ~User_table() {}
   private:
    friend class Grant_tables;
 +  virtual int setup_sysvars() const = 0;
 +};
  
 -  /* Only Grant_tables can instantiate this class. */
 -  User_table() {};
 +/* MySQL-3.23 to MariaDB 10.3 `user` table */
 +class User_table_tabular: public User_table
 +{
 + public:
  
 -  void init(enum thr_lock_type lock_type)
 +  LEX_CSTRING& name() const { return MYSQL_TABLE_NAME_USER; }
 +
 +  int get_auth(THD *thd, MEM_ROOT *root, ACL_USER *u) const
    {
 -    /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
 -    tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_USER_NAME, NULL, lock_type);
 -    Grant_table_base::init(lock_type, false);
 +    u->alloc_auth(root, 1);
 +    if (have_password())
 +    {
 +      const char *as= safe_str(::get_field(&acl_memroot, password()));
 +      u->auth->auth_string.str= as;
 +      u->auth->auth_string.length= strlen(as);
 +      u->auth->plugin= guess_auth_plugin(thd, u->auth->auth_string.length);
 +    }
 +    else
 +    {
 +      u->auth->plugin= native_password_plugin_name;
 +      u->auth->auth_string= empty_clex_str;
 +    }
 +    if (plugin() && authstr())
 +    {
 +      char *tmpstr= ::get_field(&acl_memroot, plugin());
 +      if (tmpstr)
 +      {
 +        const char *pw= u->auth->auth_string.str;
 +        const char *as= safe_str(::get_field(&acl_memroot, authstr()));
 +        if (*pw)
 +        {
 +          if (*as && strcmp(as, pw))
 +          {
 +            sql_print_warning("'user' entry '%s@%s' has both a password and an "
 +              "authentication plugin specified. The password will be ignored.",
 +              safe_str(get_user(thd->mem_root)), safe_str(get_host(thd->mem_root)));
 +          }
 +          else
 +            as= pw;
 +        }
 +        u->auth->plugin.str= tmpstr;
 +        u->auth->plugin.length= strlen(tmpstr);
 +        u->auth->auth_string.str= as;
 +        u->auth->auth_string.length= strlen(as);
 +      }
 +    }
 +    return 0;
    }
  
 -  /* The user table is a bit different compared to the other Grant tables.
 -     Usually, we only add columns to the grant tables when adding functionality.
 -     This makes it easy to test which version of the table we are using, by
 -     just looking at the number of fields present in the table.
 -
 -     In MySQL 5.7.6 the Password column was removed. We need to guard for that.
 -     The field-fetching methods for the User table return NULL if the field
 -     doesn't exist. This simplifies checking of table "version", as we don't
 -     have to make use of num_fields() any more.
 -  */
 -  inline Field* get_field(uint field_num) const
 +  bool set_auth(const ACL_USER &u) const
    {
 -    if (field_num >= num_fields())
 -      return NULL;
 -
 -    return tl.table->field[field_num];
 +    if (u.nauth != 1)
 +      return 1;
 +    if (plugin())
 +    {
 +      if (have_password())
 +        password()->reset();
 +      plugin()->store(u.auth->plugin.str, u.auth->plugin.length, system_charset_info);
 +      authstr()->store(u.auth->auth_string.str, u.auth->auth_string.length, system_charset_info);
 +    }
 +    else
 +    {
 +      if (u.auth->plugin.str != native_password_plugin_name.str &&
 +          u.auth->plugin.str != old_password_plugin_name.str)
 +        return 1;
 +      password()->store(u.auth->auth_string.str, u.auth->auth_string.length, system_charset_info);
 +    }
 +    return 0;
    }
  
 -  /* Normally password column is the third column in the table. If privileges
 -     start on the third column instead, we are missing the password column.
 -     This means we are using a MySQL 5.7.6+ data directory. */
 -  bool have_password() const { return start_privilege_column == 2; }
 +  ulong get_access() const
 +  {
 +    ulong access= Grant_table_base::get_access();
 +    if ((num_fields() <= 13) && (access & CREATE_ACL))
 +      access|=REFERENCES_ACL | INDEX_ACL | ALTER_ACL;
  
 -};
 +    if (num_fields() <= 18)
 +    {
 +      access|= LOCK_TABLES_ACL | CREATE_TMP_ACL | SHOW_DB_ACL;
 +      if (access & FILE_ACL)
 +        access|= REPL_CLIENT_ACL | REPL_SLAVE_ACL;
 +      if (access & PROCESS_ACL)
 +        access|= SUPER_ACL | EXECUTE_ACL;
 +    }
  
 -class Db_table: public Grant_table_base
 -{
 - public:
 -  Field* host() const { return tl.table->field[0]; }
 -  Field* db() const { return tl.table->field[1]; }
 -  Field* user() const { return tl.table->field[2]; }
 +    if (num_fields() <= 31 && (access & CREATE_ACL))
 +      access|= (CREATE_VIEW_ACL | SHOW_VIEW_ACL);
  
 - private:
 -  friend class Grant_tables;
 +    if (num_fields() <= 33)
 +    {
 +      if (access & CREATE_ACL)
 +        access|= CREATE_PROC_ACL;
 +      if (access & ALTER_ACL)
 +        access|= ALTER_PROC_ACL;
 +    }
  
 -  Db_table() {};
 +    if (num_fields() <= 36 && (access & GRANT_ACL))
 +      access|= CREATE_USER_ACL;
  
 -  void init(enum thr_lock_type lock_type)
 -  {
 -    /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
 -    tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_DB_NAME, NULL, lock_type);
 -    Grant_table_base::init(lock_type, false);
 -  }
 -};
 +    if (num_fields() <= 37 && (access & SUPER_ACL))
 +      access|= EVENT_ACL;
  
 -class Tables_priv_table: public Grant_table_base
 -{
 - public:
 -  Field* host() const { return tl.table->field[0]; }
 -  Field* db() const { return tl.table->field[1]; }
 -  Field* user() const { return tl.table->field[2]; }
 -  Field* table_name() const { return tl.table->field[3]; }
 -  Field* grantor() const { return tl.table->field[4]; }
 -  Field* timestamp() const { return tl.table->field[5]; }
 -  Field* table_priv() const { return tl.table->field[6]; }
 -  Field* column_priv() const { return tl.table->field[7]; }
 +    if (num_fields() <= 38 && (access & SUPER_ACL))
 +      access|= TRIGGER_ACL;
  
 - private:
 -  friend class Grant_tables;
 +    if (num_fields() <= 46 && (access & DELETE_ACL))
 +      access|= DELETE_HISTORY_ACL;
  
 -  Tables_priv_table() {};
 +    return access & GLOBAL_ACLS;
 +  }
  
 -  void init(enum thr_lock_type lock_type, Grant_table_base *next_table= NULL)
 +  void set_access(ulong rights, bool revoke) const
    {
 -    /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
 -    LEX_CSTRING MYSQL_TABLES_PRIV_NAME={STRING_WITH_LEN("tables_priv") };
 -    tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_TABLES_PRIV_NAME, NULL, lock_type);
 -    Grant_table_base::init(lock_type, false);
 +    ulong priv= SELECT_ACL;
 +    for (uint i= start_priv_columns; i < end_priv_columns; i++, priv <<= 1)
 +    {
 +      if (priv & rights)
 +        m_table->field[i]->store(1 + !revoke, 0);
 +    }
    }
 -};
 -
 -class Columns_priv_table: public Grant_table_base
 -{
 - public:
 -  Field* host() const { return tl.table->field[0]; }
 -  Field* db() const { return tl.table->field[1]; }
 -  Field* user() const { return tl.table->field[2]; }
 -  Field* table_name() const { return tl.table->field[3]; }
 -  Field* column_name() const { return tl.table->field[4]; }
 -  Field* timestamp() const { return tl.table->field[5]; }
 -  Field* column_priv() const { return tl.table->field[6]; }
 -
 - private:
 -  friend class Grant_tables;
 -
 -  Columns_priv_table() {};
  
 -  void init(enum thr_lock_type lock_type)
 +  SSL_type get_ssl_type () const
    {
 -    /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
 -    LEX_CSTRING MYSQL_COLUMNS_PRIV_NAME={ STRING_WITH_LEN("columns_priv") };
 -    tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_COLUMNS_PRIV_NAME, NULL, lock_type);
 -    Grant_table_base::init(lock_type, false);
 +    Field *f= get_field(end_priv_columns, MYSQL_TYPE_ENUM);
 +    return (SSL_type)(f ? f->val_int()-1 : 0);
    }
 -};
 -
 -class Host_table: public Grant_table_base
 -{
 - public:
 -  Field* host() const { return tl.table->field[0]; }
 -  Field* db() const { return tl.table->field[1]; }
 -
 - private:
 -  friend class Grant_tables;
 -
 -  Host_table() {}
 -
 -  void init(enum thr_lock_type lock_type)
 +  int set_ssl_type (SSL_type x) const
    {
 -    /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
 -    LEX_CSTRING MYSQL_HOST_NAME={STRING_WITH_LEN("host") };
 -    tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_HOST_NAME, NULL, lock_type);
 -    Grant_table_base::init(lock_type, true);
 +    if (Field *f= get_field(end_priv_columns, MYSQL_TYPE_ENUM))
 +      return f->store(x+1, 0);
 +    else
 +      return 1;
    }
 -};
 -
 -class Procs_priv_table: public Grant_table_base
 -{
 - public:
 -  Field* host() const { return tl.table->field[0]; }
 -  Field* db() const { return tl.table->field[1]; }
 -  Field* user() const { return tl.table->field[2]; }
 -  Field* routine_name() const { return tl.table->field[3]; }
 -  Field* routine_type() const { return tl.table->field[4]; }
 -  Field* grantor() const { return tl.table->field[5]; }
 -  Field* proc_priv() const { return tl.table->field[6]; }
 -  Field* timestamp() const { return tl.table->field[7]; }
 -
 - private:
 -  friend class Grant_tables;
 -
 -  Procs_priv_table() {}
 -
 -  void init(enum thr_lock_type lock_type)
 +  const char* get_ssl_cipher (MEM_ROOT *root) const
    {
 -    /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
 -    LEX_CSTRING MYSQL_PROCS_PRIV_NAME={STRING_WITH_LEN("procs_priv") };
 -    tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_PROCS_PRIV_NAME, NULL, lock_type);
 -    Grant_table_base::init(lock_type, true);
 +    Field *f= get_field(end_priv_columns + 1, MYSQL_TYPE_BLOB);
 +    return f ? ::get_field(root,f) : 0;
    }
 -};
 -
 -class Proxies_priv_table: public Grant_table_base
 -{
 - public:
 -  Field* host() const { return tl.table->field[0]; }
 -  Field* user() const { return tl.table->field[1]; }
 -  Field* proxied_host() const { return tl.table->field[2]; }
 -  Field* proxied_user() const { return tl.table->field[3]; }
 -  Field* with_grant() const { return tl.table->field[4]; }
 -  Field* grantor() const { return tl.table->field[5]; }
 -  Field* timestamp() const { return tl.table->field[6]; }
 -
 - private:
 -  friend class Grant_tables;
 -
 -  Proxies_priv_table() {}
 -
 -  void init(enum thr_lock_type lock_type)
 +  int set_ssl_cipher (const char *s, size_t l) const
    {
 -    /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
 -    LEX_CSTRING MYSQL_PROXIES_PRIV_NAME={STRING_WITH_LEN("proxies_priv") };
 -    tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_PROXIES_PRIV_NAME, NULL, lock_type);
 -    Grant_table_base::init(lock_type, true);
 +    if (Field *f= get_field(end_priv_columns + 1, MYSQL_TYPE_BLOB))
 +      return f->store(s, l, &my_charset_latin1);
 +    else
 +      return 1;
    }
 -};
 -
 -class Roles_mapping_table: public Grant_table_base
 -{
 - public:
 -  Field* host() const { return tl.table->field[0]; }
 -  Field* user() const { return tl.table->field[1]; }
 -  Field* role() const { return tl.table->field[2]; }
 -  Field* admin_option() const { return tl.table->field[3]; }
 -
 - private:
 -  friend class Grant_tables;
 -
 -  Roles_mapping_table() {}
 -
 -  void init(enum thr_lock_type lock_type)
 +  const char* get_x509_issuer (MEM_ROOT *root) const
    {
 -    /* We are relying on init_one_table zeroing out the TABLE_LIST structure. */
 -    LEX_CSTRING MYSQL_ROLES_MAPPING_NAME={STRING_WITH_LEN("roles_mapping") };
 -    tl.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_ROLES_MAPPING_NAME, NULL, lock_type);
 -    Grant_table_base::init(lock_type, true);
 +    Field *f= get_field(end_priv_columns + 2, MYSQL_TYPE_BLOB);
 +    return f ? ::get_field(root,f) : 0;
    }
 -};
 -
 -/**
 -  Class that represents a collection of grant tables.
 -*/
 -class Grant_tables
 -{
 - public:
 -  /* When constructing the Grant_tables object, we initialize only
 -     the tables which are going to be opened.
 -     @param which_tables   Bitmap of which tables to open.
 -     @param lock_type      Lock type to use when opening tables.
 -  */
 -  Grant_tables(int which_tables, enum thr_lock_type lock_type)
 +  int set_x509_issuer (const char *s, size_t l) const
    {
 -    DBUG_ENTER("Grant_tables::Grant_tables");
 -    DBUG_PRINT("info", ("which_tables: %x, lock_type: %u",
 -                        which_tables, lock_type));
 -    DBUG_ASSERT(which_tables); /* At least one table must be opened. */
 -    Grant_table_base* prev= NULL;
 -    /* We start from the last table, Table_roles_mapping, such that
 -       the first one in the linked list is Table_user. */
 -    if (which_tables & Table_roles_mapping)
 -    {
 -      m_roles_mapping_table.init(lock_type);
 -      prev= &m_roles_mapping_table;
 -    }
 -    if (which_tables & Table_proxies_priv)
 -    {
 -      m_proxies_priv_table.init(lock_type);
 -      link_tables(&m_proxies_priv_table, prev);
 -      prev= &m_proxies_priv_table;
 -    }
 -    if (which_tables & Table_procs_priv)
 -    {
 -      m_procs_priv_table.init(lock_type);
 -      link_tables(&m_procs_priv_table, prev);
 -      prev= &m_procs_priv_table;
 -    }
 -    if (which_tables & Table_host)
 -    {
 -      m_host_table.init(lock_type);
 -      link_tables(&m_host_table, prev);
 -      prev= &m_host_table;
 -    }
 -    if (which_tables & Table_columns_priv)
 -    {
 -      m_columns_priv_table.init(lock_type);
 -      link_tables(&m_columns_priv_table, prev);
 -      prev= &m_columns_priv_table;
 -    }
 -    if (which_tables & Table_tables_priv)
 -    {
 -      m_tables_priv_table.init(lock_type);
 -      link_tables(&m_tables_priv_table, prev);
 -      prev= &m_tables_priv_table;
 -    }
 -    if (which_tables & Table_db)
 -    {
 -      m_db_table.init(lock_type);
 -      link_tables(&m_db_table, prev);
 -      prev= &m_db_table;
 -    }
 -    if (which_tables & Table_user)
 -    {
 -      m_user_table.init(lock_type);
 -      link_tables(&m_user_table, prev);
 -      prev= &m_user_table;
 -    }
 -
 -    first_table_in_list= prev;
 -    DBUG_VOID_RETURN;
 +    if (Field *f= get_field(end_priv_columns + 2, MYSQL_TYPE_BLOB))
 +      return f->store(s, l, &my_charset_latin1);
 +    else
 +      return 1;
    }
 -
 -  /* Before any operation is possible on grant tables, they must be opened.
 -     This opens the tables according to the lock type specified during
 -     construction.
 -
 -     @retval  1 replication filters matched. Abort the operation,
 -                but return OK (!)
 -     @retval  0 tables were opened successfully
 -     @retval -1 error, tables could not be opened
 -  */
 -  int open_and_lock(THD *thd)
 +  const char* get_x509_subject (MEM_ROOT *root) const
    {
 -    DBUG_ENTER("Grant_tables::open_and_lock");
 -    DBUG_ASSERT(first_table_in_list);
 -#ifdef HAVE_REPLICATION
 -    if (first_table_in_list->tl.lock_type >= TL_WRITE_ALLOW_WRITE &&
 -        thd->slave_thread && !thd->spcont)
 -    {
 -      /*
 -        GRANT and REVOKE are applied the slave in/exclusion rules as they are
 -        some kind of updates to the mysql.% tables.
 -      */
 -      Rpl_filter *rpl_filter= thd->system_thread_info.rpl_sql_info->rpl_filter;
 -      if (rpl_filter->is_on() &&
 -          !rpl_filter->tables_ok(0, &first_table_in_list->tl))
 -        DBUG_RETURN(1);
 +    Field *f= get_field(end_priv_columns + 3, MYSQL_TYPE_BLOB);
 +    return f ? ::get_field(root,f) : 0;
 +  }
 +  int set_x509_subject (const char *s, size_t l) const
 +  {
 +    if (Field *f= get_field(end_priv_columns + 3, MYSQL_TYPE_BLOB))
 +      return f->store(s, l, &my_charset_latin1);
 +    else
 +      return 1;
 +  }
 +  longlong get_max_questions () const
 +  {
 +    Field *f= get_field(end_priv_columns + 4, MYSQL_TYPE_LONG);
 +    return f ? f->val_int() : 0;
 +  }
 +  int set_max_questions (longlong x) const
 +  {
 +    if (Field *f= get_field(end_priv_columns + 4, MYSQL_TYPE_LONG))
 +      return f->store(x, 0);
 +    else
 +      return 1;
 +  }
 +  longlong get_max_updates () const
 +  {
 +    Field *f= get_field(end_priv_columns + 5, MYSQL_TYPE_LONG);
 +    return f ? f->val_int() : 0;
 +  }
 +  int set_max_updates (longlong x) const
 +  {
 +    if (Field *f= get_field(end_priv_columns + 5, MYSQL_TYPE_LONG))
 +      return f->store(x, 0);
 +    else
 +      return 1;
 +  }
 +  longlong get_max_connections () const
 +  {
 +    Field *f= get_field(end_priv_columns + 6, MYSQL_TYPE_LONG);
 +    return f ? f->val_int() : 0;
 +  }
 +  int set_max_connections (longlong x) const
 +  {
 +    if (Field *f= get_field(end_priv_columns + 6, MYSQL_TYPE_LONG))
 +      return f->store(x, 0);
 +    else
 +      return 1;
 +  }
 +  longlong get_max_user_connections () const
 +  {
 +    Field *f= get_field(end_priv_columns + 7, MYSQL_TYPE_LONG);
 +    return f ? f->val_int() : 0;
 +  }
 +  int set_max_user_connections (longlong x) const
 +  {
 +    if (Field *f= get_field(end_priv_columns + 7, MYSQL_TYPE_LONG))
 +      return f->store(x, 0);
 +    else
 +      return 1;
 +  }
 +  double get_max_statement_time () const
 +  {
 +    Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_NEWDECIMAL);
 +    return f ? f->val_real() : 0;
 +  }
 +  int set_max_statement_time (double x) const
 +  {
 +    if (Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_NEWDECIMAL))
 +      return f->store(x);
 +    else
 +      return 1;
 +  }
 +  bool get_is_role () const
 +  {
 +    Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_ENUM);
 +    return f ? f->val_int()-1 : 0;
 +  }
 +  int set_is_role (bool x) const
 +  {
 +    if (Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_ENUM))
 +      return f->store(x+1, 0);
 +    else
 +      return 1;
 +  }
 +  const char* get_default_role (MEM_ROOT *root) const
 +  {
 +    Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_STRING);
 +    return f ? ::get_field(root,f) : 0;
 +  }
 +  int set_default_role (const char *s, size_t l) const
 +  {
 +    if (Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_STRING))
 +      return f->store(s, l, system_charset_info);
 +    else
 +      return 1;
 +  }
 +  /* On a MariaDB 10.3 user table, the account locking accessors will try to
 +     get the content of the max_statement_time column, but they will fail due
 +     to the typecheck in get_field. */
 +  bool get_account_locked () const
 +  {
 +    Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_ENUM);
 +    return f ? f->val_int()-1 : 0;
 +  }
 +  int set_account_locked (bool x) const
 +  {
 +    if (Field *f= get_field(end_priv_columns + 13, MYSQL_TYPE_ENUM))
 +      return f->store(x+1, 0);
 +
 +    return 1;
 +  }
 +
 +  bool get_password_expired () const
 +  {
 +    uint field_num= end_priv_columns + 10;
 +
 +    Field *f= get_field(field_num, MYSQL_TYPE_ENUM);
 +    return f ? f->val_int()-1 : 0;
 +  }
 +  int set_password_expired (bool x) const
 +  {
 +    uint field_num= end_priv_columns + 10;
 +
 +    if (Field *f= get_field(field_num, MYSQL_TYPE_ENUM))
 +      return f->store(x+1, 0);
 +    return 1;
 +  }
 +  my_time_t get_password_last_changed () const
 +  {
 +    ulong unused_dec;
 +    if (Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_TIMESTAMP2))
 +      return f->get_timestamp(&unused_dec);
 +    return 0;
 +  }
 +  int set_password_last_changed (my_time_t x) const
 +  {
 +    if (Field *f= get_field(end_priv_columns + 11, MYSQL_TYPE_TIMESTAMP2))
 +    {
 +      f->set_notnull();
 +      return f->store_timestamp(x, 0);
      }
 -#endif
 -    if (open_and_lock_tables(thd, &first_table_in_list->tl, FALSE,
 -                             MYSQL_LOCK_IGNORE_TIMEOUT))
 -      DBUG_RETURN(-1);
 +    return 1;
 +  }
 +  longlong get_password_lifetime () const
 +  {
 +    if (Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_SHORT))
 +    {
 +      if (f->is_null())
 +        return -1;
 +      return f->val_int();
 +    }
 +    return 0;
 +  }
 +  int set_password_lifetime (longlong x) const
 +  {
 +    if (Field *f= get_field(end_priv_columns + 12, MYSQL_TYPE_SHORT))
 +    {
 +      if (x < 0)
 +      {
 +        f->set_null();
 +        return 0;
 +      }
 +      f->set_notnull();
 +      return f->store(x, 0);
 +    }
 +    return 1;
 +  }
 +
 +  virtual ~User_table_tabular() {}
 + private:
 +  friend class Grant_tables;
 +
 +  /* Only Grant_tables can instantiate this class. */
 +  User_table_tabular() {}
 +
 +  /* The user table is a bit different compared to the other Grant tables.
 +     Usually, we only add columns to the grant tables when adding functionality.
 +     This makes it easy to test which version of the table we are using, by
 +     just looking at the number of fields present in the table.
 +
 +     In MySQL 5.7.6 the Password column was removed. We need to guard for that.
 +     The field-fetching methods for the User table return NULL if the field
 +     doesn't exist. This simplifies checking of table "version", as we don't
 +     have to make use of num_fields() any more.
 +  */
 +  inline Field* get_field(uint field_num, enum enum_field_types type) const
 +  {
 +    if (field_num >= num_fields())
 +      return NULL;
 +    Field *f= m_table->field[field_num];
 +    return f->real_type() == type ? f : NULL;
 +  }
 +
 +  int setup_sysvars() const
 +  {
++    if (num_fields() < 13) // number of columns in 3.21
++    {
++      sql_print_error("Fatal error: mysql.user table is damaged or in "
++                      "unsupported 3.20 format.");
++      return 1;
++    }
++
 +    username_char_length= MY_MIN(m_table->field[1]->char_length(),
 +                                 USERNAME_CHAR_LENGTH);
 +    using_global_priv_table= false;
 +
 +    if (have_password()) // Password column might be missing. (MySQL 5.7.6+)
 +    {
 +      int password_length= password()->field_length /
 +                           password()->charset()->mbmaxlen;
 +      if (password_length < SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
 +      {
 +        sql_print_error("Fatal error: mysql.user table is damaged or in "
 +                        "unsupported 3.20 format.");
 +        return 1;
 +      }
 +
 +      mysql_mutex_lock(&LOCK_global_system_variables);
 +      if (password_length < SCRAMBLED_PASSWORD_CHAR_LENGTH)
 +      {
 +        if (opt_secure_auth)
 +        {
 +          mysql_mutex_unlock(&LOCK_global_system_variables);
 +          sql_print_error("Fatal error: mysql.user table is in old format, "
 +                          "but server started with --secure-auth option.");
 +          return 1;
 +        }
 +        mysql_user_table_is_in_short_password_format= true;
 +        if (global_system_variables.old_passwords)
 +          mysql_mutex_unlock(&LOCK_global_system_variables);
 +        else
 +        {
 +          extern sys_var *Sys_old_passwords_ptr;
 +          Sys_old_passwords_ptr->value_origin= sys_var::AUTO;
 +          global_system_variables.old_passwords= 1;
 +          mysql_mutex_unlock(&LOCK_global_system_variables);
 +          sql_print_warning("mysql.user table is not updated to new password format; "
 +                            "Disabling new password usage until "
 +                            "mysql_fix_privilege_tables is run");
 +        }
 +        m_table->in_use->variables.old_passwords= 1;
 +      }
 +      else
 +      {
 +        mysql_user_table_is_in_short_password_format= false;
 +        mysql_mutex_unlock(&LOCK_global_system_variables);
 +      }
 +    }
 +    return 0;
 +  }
 +
 +  /* Normally password column is the third column in the table. If privileges
 +     start on the third column instead, we are missing the password column.
 +     This means we are using a MySQL 5.7.6+ data directory. */
 +  bool have_password() const { return start_priv_columns == 3; }
 +
 +  Field* password() const { return m_table->field[2]; }
 +  Field* plugin() const   { return get_field(end_priv_columns + 8, MYSQL_TYPE_STRING); }
 +  Field* authstr() const  { return get_field(end_priv_columns + 9, MYSQL_TYPE_BLOB); }
 +};
 +
 +/*
 +  MariaDB 10.4 and up `global_priv` table
 +
 +  TODO possible optimizations:
 +  * update json in-place if the new value can fit
 +  * don't repeat get_value for every key, but use a streaming parser
 +    to convert json into in-memory object (ACL_USER?) in one json scan.
 +    - this makes sense for acl_load(), but hardly for GRANT
 +  * similarly, pack ACL_USER (?) into json in one go.
 +    - doesn't make sense? GRANT rarely updates more than one field.
 +*/
 +class User_table_json: public User_table
 +{
 +  LEX_CSTRING& name() const { return MYSQL_TABLE_NAME[USER_TABLE]; }
 +
 +  int get_auth(THD *thd, MEM_ROOT *root, ACL_USER *u) const
 +  {
 +    size_t array_len;
 +    const char *array;
 +    int vl;
 +    const char *v;
 +
 +    if (get_value("auth_or", JSV_ARRAY, &array, &array_len))
 +    {
 +      u->alloc_auth(root, 1);
 +      return get_auth1(thd, root, u, 0);
 +    }
 +
 +    if (json_get_array_item(array, array + array_len, (int)array_len,
 +                            &v, &vl) != JSV_NOTHING)
 +      return 1;
 +    u->alloc_auth(root, vl);
 +    for (uint i=0; i < u->nauth; i++)
 +    {
 +      if (json_get_array_item(array, array + array_len, i, &v, &vl) != JSV_OBJECT)
 +        return 1;
 +
 +      const char *p, *a;
 +      int pl, al;
 +      switch (json_get_object_key(v, v + vl, "plugin", &p, &pl)) {
 +      case JSV_STRING: u->auth[i].plugin.str= strmake_root(root, p, pl);
 +                       u->auth[i].plugin.length= pl;
 +                       break;
 +      case JSV_NOTHING: if (get_auth1(thd, root, u, i))
 +                          return 1;
 +                        else
 +                          continue;
 +      default: return 1;
 +      }
 +      switch (json_get_object_key(v, v + vl, "authentication_string", &a, &al)) {
 +      case JSV_NOTHING: u->auth[i].auth_string= empty_clex_str;
 +                        break;
 +      case JSV_STRING: u->auth[i].auth_string.str= strmake_root(root, a, al);
 +                       u->auth[i].auth_string.length= al;
 +                       break;
 +      default: return 1;
 +      }
 +    }
 +    return 0;
 +  }
 +
 +  int get_auth1(THD *thd, MEM_ROOT *root, ACL_USER *u, uint n) const
 +  {
 +    const char *authstr= get_str_value(root, "authentication_string");
 +    const char *plugin= get_str_value(root, "plugin");
 +    if (plugin && authstr)
 +    {
 +      if (plugin && *plugin)
 +      {
 +        u->auth[n].plugin.str= plugin;
 +        u->auth[n].plugin.length= strlen(plugin);
 +      }
 +      else
 +        u->auth[n].plugin= native_password_plugin_name;
 +      u->auth[n].auth_string.str= authstr;
 +      u->auth[n].auth_string.length= strlen(authstr);
 +      return 0;
 +    }
 +    return 1;
 +  }
 +
 +  bool append_str_value(String *to, const LEX_CSTRING &str) const
 +  {
 +    to->append('"');
 +    to->reserve(str.length*2);
 +    int len= json_escape(system_charset_info, (uchar*)str.str, (uchar*)str.str + str.length,
 +                         to->charset(), (uchar*)to->end(), (uchar*)to->end() + str.length*2);
 +    if (len < 0)
 +      return 1;
 +    to->length(to->length() + len);
 +    to->append('"');
 +    return 0;
 +  }
 +
 +  bool set_auth(const ACL_USER &u) const
 +  {
 +    StringBuffer<JSON_SIZE> json(m_table->field[2]->charset());
 +    if (u.nauth == 1)
 +      return set_auth1(u, 0);
 +    bool top_done = false;
 +    json.append('[');
 +    for (uint i=0; i < u.nauth; i++)
 +    {
 +      ACL_USER::AUTH * const auth= u.auth + i;
 +      if (i)
 +        json.append(',');
 +      json.append('{');
 +      if (!top_done &&
 +          (auth->plugin.str == native_password_plugin_name.str ||
 +           auth->plugin.str == old_password_plugin_name.str ||
 +           i == u.nauth - 1))
 +      {
 +        if (set_auth1(u, i))
 +          return 1;
 +        top_done= true;
 +      }
 +      else
 +      {
 +        json.append(STRING_WITH_LEN("\"plugin\":"));
 +        if (append_str_value(&json, auth->plugin))
 +          return 1;
 +        if (auth->auth_string.length)
 +        {
 +          json.append(STRING_WITH_LEN(",\"authentication_string\":"));
 +          if (append_str_value(&json, auth->auth_string))
 +            return 1;
 +        }
 +      }
 +      json.append('}');
 +    }
 +    json.append(']');
 +    return set_value("auth_or", json.ptr(), json.length(), false) == JSV_BAD_JSON;
 +  }
 +  bool set_auth1(const ACL_USER &u, uint i) const
 +  {
 +    return set_str_value("plugin",
 +                         u.auth[i].plugin.str, u.auth[i].plugin.length) ||
 +            set_str_value("authentication_string",
 +                         u.auth[i].auth_string.str, u.auth[i].auth_string.length);
 +  }
 +  ulong get_access() const
 +  {
 +    /*
 +      when new privileges will be added, we'll start storing GLOBAL_ACLS
 +      (or, for example, my_count_bits(GLOBAL_ACLS))
 +      in the json too, and it'll allow us to do privilege upgrades
 +    */
 +    return get_int_value("access") & GLOBAL_ACLS;
 +  }
 +  void set_access(ulong rights, bool revoke) const
 +  {
 +    ulong access= get_access();
 +    if (revoke)
 +      access&= ~rights;
 +    else
 +      access|= rights;
 +    set_int_value("access", access & GLOBAL_ACLS);
 +  }
 +  const char *unsafe_str(const char *s) const
 +  { return s[0] ? s : NULL; }
 +
 +  SSL_type get_ssl_type () const
 +  { return (SSL_type)get_int_value("ssl_type"); }
 +  int set_ssl_type (SSL_type x) const
 +  { return set_int_value("ssl_type", x); }
 +  const char* get_ssl_cipher (MEM_ROOT *root) const
 +  { return unsafe_str(get_str_value(root, "ssl_cipher")); }
 +  int set_ssl_cipher (const char *s, size_t l) const
 +  { return set_str_value("ssl_cipher", s, l); }
 +  const char* get_x509_issuer (MEM_ROOT *root) const
 +  { return unsafe_str(get_str_value(root, "x509_issuer")); }
 +  int set_x509_issuer (const char *s, size_t l) const
 +  { return set_str_value("x509_issuer", s, l); }
 +  const char* get_x509_subject (MEM_ROOT *root) const
 +  { return unsafe_str(get_str_value(root, "x509_subject")); }
 +  int set_x509_subject (const char *s, size_t l) const
 +  { return set_str_value("x509_subject", s, l); }
 +  longlong get_max_questions () const
 +  { return get_int_value("max_questions"); }
 +  int set_max_questions (longlong x) const
 +  { return set_int_value("max_questions", x); }
 +  longlong get_max_updates () const
 +  { return get_int_value("max_updates"); }
 +  int set_max_updates (longlong x) const
 +  { return set_int_value("max_updates", x); }
 +  longlong get_max_connections () const
 +  { return get_int_value("max_connections"); }
 +  int set_max_connections (longlong x) const
 +  { return set_int_value("max_connections", x); }
 +  longlong get_max_user_connections () const
 +  { return get_int_value("max_user_connections"); }
 +  int set_max_user_connections (longlong x) const
 +  { return set_int_value("max_user_connections", x); }
 +  double get_max_statement_time () const
 +  { return get_double_value("max_statement_time"); }
 +  int set_max_statement_time (double x) const
 +  { return set_double_value("max_statement_time", x); }
 +  bool get_is_role () const
 +  { return get_bool_value("is_role"); }
 +  int set_is_role (bool x) const
 +  { return set_bool_value("is_role", x); }
 +  const char* get_default_role (MEM_ROOT *root) const
 +  { return get_str_value(root, "default_role"); }
 +  int set_default_role (const char *s, size_t l) const
 +  { return set_str_value("default_role", s, l); }
 +  bool get_account_locked () const
 +  { return get_bool_value("account_locked"); }
 +  int set_account_locked (bool x) const
 +  { return set_bool_value("account_locked", x); }
 +  my_time_t get_password_last_changed () const
 +  { return static_cast<my_time_t>(get_int_value("password_last_changed")); }
 +  int set_password_last_changed (my_time_t x) const
 +  { return set_int_value("password_last_changed", static_cast<longlong>(x)); }
 +  int set_password_lifetime (longlong x) const
 +  { return set_int_value("password_lifetime", x); }
 +  longlong get_password_lifetime () const
 +  { return get_int_value("password_lifetime", -1); }
 +  /*
 +     password_last_changed=0 means the password is manually expired.
 +     In MySQL 5.7+ this state is described using the password_expired column
 +     in mysql.user
 +  */
 +  bool get_password_expired () const
 +  { return get_int_value("password_last_changed", -1) == 0; }
 +  int set_password_expired (bool x) const
 +  { return x ? set_password_last_changed(0) : 0; }
 +
 +  ~User_table_json() {}
 + private:
 +  friend class Grant_tables;
 +  static const uint JSON_SIZE=1024;
 +  int setup_sysvars() const
 +  {
 +    using_global_priv_table= true;
 +    username_char_length= MY_MIN(m_table->field[1]->char_length(),
 +                                 USERNAME_CHAR_LENGTH);
 +    return 0;
 +  }
 +  bool get_value(const char *key, 
 +                 enum json_types vt, const char **v, size_t *vl) const
 +  {
 +    enum json_types value_type;
 +    int int_vl;
 +    String str, *res= m_table->field[2]->val_str(&str);
 +    if (!res ||
 +        (value_type= json_get_object_key(res->ptr(), res->end(), key,
 +                                             v, &int_vl)) == JSV_BAD_JSON)
 +      return 1; // invalid
 +    *vl= int_vl;
 +    return value_type != vt;
 +  }
 +  const char *get_str_value(MEM_ROOT *root, const char *key) const
 +  {
 +    size_t value_len;
 +    const char *value_start;
 +    if (get_value(key, JSV_STRING, &value_start, &value_len))
 +      return "";
 +    char *ptr= (char*)alloca(value_len);
 +    int len= json_unescape(m_table->field[2]->charset(),
 +                           (const uchar*)value_start,
 +                           (const uchar*)value_start + value_len,
 +                           system_charset_info,
 +                           (uchar*)ptr, (uchar*)ptr + value_len);
 +    if (len < 0)
 +      return NULL;
 +    return strmake_root(root, ptr, len);
 +  }
 +  longlong get_int_value(const char *key, longlong def_val= 0) const
 +  {
 +    int err;
 +    size_t value_len;
 +    const char *value_start;
 +    if (get_value(key, JSV_NUMBER, &value_start, &value_len))
 +      return def_val;
 +    const char *value_end= value_start + value_len;
 +    return my_strtoll10(value_start, (char**)&value_end, &err);
 +  }
 +  double get_double_value(const char *key) const
 +  {
 +    int err;
 +    size_t value_len;
 +    const char *value_start;
 +    if (get_value(key, JSV_NUMBER, &value_start, &value_len))
 +      return 0;
 +    const char *value_end= value_start + value_len;
 +    return my_strtod(value_start, (char**)&value_end, &err);
 +  }
 +  bool get_bool_value(const char *key) const
 +  {
 +    size_t value_len;
 +    const char *value_start;
 +    if (get_value(key, JSV_TRUE, &value_start, &value_len))
 +      return false;
 +    return true;
 +  }
 +  enum json_types set_value(const char *key,
 +                            const char *val, size_t vlen, bool string) const
 +  {
 +    int value_len;
 +    const char *value_start;
 +    enum json_types value_type;
 +    String str, *res= m_table->field[2]->val_str(&str);
 +    if (!res || !res->length())
 +      (res= &str)->set(STRING_WITH_LEN("{}"), m_table->field[2]->charset());
 +    value_type= json_get_object_key(res->ptr(), res->end(), key,
 +                                    &value_start, &value_len);
 +    if (value_type == JSV_BAD_JSON)
 +      return value_type; // invalid
 +    StringBuffer<JSON_SIZE> json(res->charset());
 +    json.copy(res->ptr(), value_start - res->ptr(), res->charset());
 +    if (value_type == JSV_NOTHING)
 +    {
 +      if (value_len)
 +        json.append(',');
 +      json.append('"');
 +      json.append(key);
 +      json.append(STRING_WITH_LEN("\":"));
 +      if (string)
 +        json.append('"');
 +    }
 +    else
 +      value_start+= value_len;
 +    json.append(val, vlen);
 +    if (!value_type && string)
 +      json.append('"');
 +    json.append(value_start, res->end() - value_start);
 +    DBUG_ASSERT(json_valid(json.ptr(), json.length(), json.charset()));
 +    m_table->field[2]->store(json.ptr(), json.length(), json.charset());
 +    return value_type;
 +  }
 +  bool set_str_value(const char *key, const char *val, size_t vlen) const
 +  {
 +    char buf[JSON_SIZE];
 +    int blen= json_escape(system_charset_info,
 +                          (const uchar*)val, (const uchar*)val + vlen,
 +                          m_table->field[2]->charset(),
 +                          (uchar*)buf, (uchar*)buf+sizeof(buf));
 +    if (blen < 0)
 +      return 1;
 +    return set_value(key, buf, blen, true) == JSV_BAD_JSON;
 +  }
 +  bool set_int_value(const char *key, longlong val) const
 +  {
 +    char v[MY_INT64_NUM_DECIMAL_DIGITS+1];
 +    size_t vlen= longlong10_to_str(val, v, -10) - v;
 +    return set_value(key, v, vlen, false) == JSV_BAD_JSON;
 +  }
 +  bool set_double_value(const char *key, double val) const
 +  {
 +    char v[FLOATING_POINT_BUFFER+1];
 +    size_t vlen= my_fcvt(val, TIME_SECOND_PART_DIGITS, v, NULL);
 +    return set_value(key, v, vlen, false) == JSV_BAD_JSON;
 +  }
 +  bool set_bool_value(const char *key, bool val) const
 +  {
 +    return set_value(key, val ? "true" : "false", val ? 4 : 5, false) == JSV_BAD_JSON;
 +  }
 +};
 +
 +class Db_table: public Grant_table_base
 +{
 + public:
 +  Field* host() const { return m_table->field[0]; }
 +  Field* db() const { return m_table->field[1]; }
 +  Field* user() const { return m_table->field[2]; }
  
 + private:
 +  friend class Grant_tables;
 +
 +  Db_table() {}
 +};
 +
 +class Tables_priv_table: public Grant_table_base
 +{
 + public:
 +  Field* host() const { return m_table->field[0]; }
 +  Field* db() const { return m_table->field[1]; }
 +  Field* user() const { return m_table->field[2]; }
 +  Field* table_name() const { return m_table->field[3]; }
 +  Field* grantor() const { return m_table->field[4]; }
 +  Field* timestamp() const { return m_table->field[5]; }
 +  Field* table_priv() const { return m_table->field[6]; }
 +  Field* column_priv() const { return m_table->field[7]; }
 +
 + private:
 +  friend class Grant_tables;
 +
 +  Tables_priv_table() {}
 +};
 +
 +class Columns_priv_table: public Grant_table_base
 +{
 + public:
 +  Field* host() const { return m_table->field[0]; }
 +  Field* db() const { return m_table->field[1]; }
 +  Field* user() const { return m_table->field[2]; }
 +  Field* table_name() const { return m_table->field[3]; }
 +  Field* column_name() const { return m_table->field[4]; }
 +  Field* timestamp() const { return m_table->field[5]; }
 +  Field* column_priv() const { return m_table->field[6]; }
 +
 + private:
 +  friend class Grant_tables;
 +
 +  Columns_priv_table() {}
 +};
 +
 +class Host_table: public Grant_table_base
 +{
 + public:
 +  Field* host() const { return m_table->field[0]; }
 +  Field* db() const { return m_table->field[1]; }
 +
 + private:
 +  friend class Grant_tables;
 +
 +  Host_table() {}
 +};
 +
 +class Procs_priv_table: public Grant_table_base
 +{
 + public:
 +  Field* host() const { return m_table->field[0]; }
 +  Field* db() const { return m_table->field[1]; }
 +  Field* user() const { return m_table->field[2]; }
 +  Field* routine_name() const { return m_table->field[3]; }
 +  Field* routine_type() const { return m_table->field[4]; }
 +  Field* grantor() const { return m_table->field[5]; }
 +  Field* proc_priv() const { return m_table->field[6]; }
 +  Field* timestamp() const { return m_table->field[7]; }
 +
 + private:
 +  friend class Grant_tables;
 +
 +  Procs_priv_table() {}
 +};
 +
 +class Proxies_priv_table: public Grant_table_base
 +{
 + public:
 +  Field* host() const { return m_table->field[0]; }
 +  Field* user() const { return m_table->field[1]; }
 +  Field* proxied_host() const { return m_table->field[2]; }
 +  Field* proxied_user() const { return m_table->field[3]; }
 +  Field* with_grant() const { return m_table->field[4]; }
 +  Field* grantor() const { return m_table->field[5]; }
 +  Field* timestamp() const { return m_table->field[6]; }
 +
 + private:
 +  friend class Grant_tables;
 +
 +  Proxies_priv_table() {}
 +};
 +
 +class Roles_mapping_table: public Grant_table_base
 +{
 + public:
 +  Field* host() const { return m_table->field[0]; }
 +  Field* user() const { return m_table->field[1]; }
 +  Field* role() const { return m_table->field[2]; }
 +  Field* admin_option() const { return m_table->field[3]; }
 +
 + private:
 +  friend class Grant_tables;
 +
 +  Roles_mapping_table() {}
 +};
 +
 +/**
 +  Class that represents a collection of grant tables.
 +*/
 +class Grant_tables
 +{
 + public:
 +  Grant_tables() : p_user_table(&m_user_table_json) { }
 +
 +  int open_and_lock(THD *thd, int which_tables, enum thr_lock_type lock_type)
 +  {
 +    DBUG_ENTER("Grant_tables::open_and_lock");
 +    TABLE_LIST tables[USER_TABLE+1], *first= NULL;
 +
 +    DBUG_ASSERT(which_tables); /* At least one table must be opened. */
      /*
         We can read privilege tables even when !initialized.
         This can be acl_load() - server startup or FLUSH PRIVILEGES
@@@ -1808,52 -1223,16 +1815,56 @@@
        DBUG_RETURN(-1);
      }
  
 -    /* The privilge columns vary based on MariaDB version. Figure out
 -       how many we have after we've opened the table. */
 -    m_user_table.compute_num_privilege_cols();
 -    m_db_table.compute_num_privilege_cols();
 -    m_tables_priv_table.compute_num_privilege_cols();
 -    m_columns_priv_table.compute_num_privilege_cols();
 -    m_host_table.compute_num_privilege_cols();
 -    m_procs_priv_table.compute_num_privilege_cols();
 -    m_proxies_priv_table.compute_num_privilege_cols();
 -    m_roles_mapping_table.compute_num_privilege_cols();
 +    for (int i=USER_TABLE; i >=0; i--)
 +    {
 +      TABLE_LIST *tl= tables + i;
 +      if (which_tables & (1 << i))
 +      {
 +        tl->init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_TABLE_NAME[i],
 +                           NULL, lock_type);
++        tl->open_type= OT_BASE_ONLY;
++        tl->i_s_requested_object= OPEN_TABLE_ONLY;
 +        tl->updating= lock_type >= TL_WRITE_ALLOW_WRITE;
 +        if (i >= FIRST_OPTIONAL_TABLE)
 +          tl->open_strategy= TABLE_LIST::OPEN_IF_EXISTS;
 +        tl->next_global= tl->next_local= first;
 +        first= tl;
 +      }
 +      else
 +        tl->table= NULL;
 +    }
 +
 +    uint counter;
 +    int res= really_open(thd, first, &counter);
 +
 +    /* if User_table_json wasn't found, let's try User_table_tabular */
 +    if (!res && (which_tables & Table_user) && !(tables[USER_TABLE].table))
 +    {
 +      uint unused;
 +      TABLE_LIST *tl= tables + USER_TABLE;
 +      tl->init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_TABLE_NAME_USER,
 +                         NULL, lock_type);
++      tl->open_type= OT_BASE_ONLY;
++      tl->i_s_requested_object= OPEN_TABLE_ONLY;
 +      tl->updating= lock_type >= TL_WRITE_ALLOW_WRITE;
 +      p_user_table= &m_user_table_tabular;
 +      counter++;
 +      res= really_open(thd, tl, &unused);
 +    }
 +    if (res)
 +      DBUG_RETURN(res);
 +
 +    if (lock_tables(thd, first, counter, MYSQL_LOCK_IGNORE_TIMEOUT))
 +      DBUG_RETURN(-1);
 +
 +    p_user_table->set_table(tables[USER_TABLE].table);
 +    m_db_table.set_table(tables[DB_TABLE].table);
 +    m_tables_priv_table.set_table(tables[TABLES_PRIV_TABLE].table);
 +    m_columns_priv_table.set_table(tables[COLUMNS_PRIV_TABLE].table);
 +    m_host_table.set_table(tables[HOST_TABLE].table);
 +    m_procs_priv_table.set_table(tables[PROCS_PRIV_TABLE].table);
 +    m_proxies_priv_table.set_table(tables[PROXIES_PRIV_TABLE].table);
 +    m_roles_mapping_table.set_table(tables[ROLES_MAPPING_TABLE].table);
      DBUG_RETURN(0);
    }
  
diff --cc sql/sql_base.cc
index 0e7059918c2,b1fa78b5ec6..60371813280
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@@ -721,8 -613,9 +727,10 @@@ static void mark_used_tables_as_free_fo
        table->query_id= 0;
        table->file->ha_reset();
      }
+     else if (table->file->check_table_binlog_row_based_done)
+       table->file->clear_cached_table_binlog_row_based_flag();
    }
 +  DBUG_VOID_RETURN;
  }
  
  
diff --cc sql/sql_class.h
index 1266e1777ce,fa2fadd598e..dd9cfbbd1c4
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@@ -39,7 -38,10 +39,8 @@@
  #include "thr_timer.h"
  #include "thr_malloc.h"
  #include "log_slow.h"      /* LOG_SLOW_DISABLE_... */
+ #include <my_tree.h>
 -
  #include "sql_digest_stream.h"            // sql_digest_state
 -
  #include <mysql/psi/mysql_stage.h>
  #include <mysql/psi/mysql_statement.h>
  #include <mysql/psi/mysql_idle.h>
diff --cc sql/sql_lex.cc
index b0544300f1d,ef58dfb2b28..573c609de79
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@@ -8820,1605 -8266,9 +8836,1615 @@@ bool LEX::tvc_finalize_derived(
      thd->parse_error();
      return true;
    }
 -  if (current_select->linkage == GLOBAL_OPTIONS_TYPE ||
 +  if (current_select->get_linkage() == GLOBAL_OPTIONS_TYPE ||
        unlikely(mysql_new_select(this, 1, NULL)))
      return true;
 -  current_select->linkage= DERIVED_TABLE_TYPE;
 +  current_select->set_linkage(DERIVED_TABLE_TYPE);
    return tvc_finalize();
  }
 +
 +
 +void st_select_lex_unit::reset_distinct()
 +{
 +  union_distinct= NULL;
 +  for(SELECT_LEX *sl= first_select()->next_select();
 +      sl;
 +      sl= sl->next_select())
 +  {
 +    if (sl->distinct)
 +    {
 +      union_distinct= sl;
 +    }
 +  }
 +}
 +
 +
 +void st_select_lex_unit::fix_distinct()
 +{
 +  if (union_distinct && this != union_distinct->master_unit())
 +    reset_distinct();
 +}
 +
 +
 +void st_select_lex_unit::register_select_chain(SELECT_LEX *first_sel)
 +{
 +  DBUG_ASSERT(first_sel != 0);
 +  slave= first_sel;
 +  first_sel->prev= &slave;
 +  for(SELECT_LEX *sel=first_sel; sel; sel= sel->next_select())
 +  {
 +    sel->master= (st_select_lex_node *)this;
 +    uncacheable|= sel->uncacheable;
 +  }
 +}
 +
 +
 +void st_select_lex::register_unit(SELECT_LEX_UNIT *unit,
 +                                  Name_resolution_context *outer_context)
 +{
 +  if ((unit->next= slave))
 +    slave->prev= &unit->next;
 +  unit->prev= &slave;
 +  slave= unit;
 +  unit->master= this;
 +  uncacheable|= unit->uncacheable;
 +
 +  for(SELECT_LEX *sel= unit->first_select();sel; sel= sel->next_select())
 +  {
 +    sel->context.outer_context= outer_context;
 +  }
 +}
 +
 +
 +void st_select_lex::add_statistics(SELECT_LEX_UNIT *unit)
 +{
 +  for (;
 +       unit;
 +       unit= unit->next_unit())
 +    for(SELECT_LEX *child= unit->first_select();
 +        child;
 +        child= child->next_select())
 +    {
 +      /*
 +        A subselect can add fields to an outer select.
 +        Reserve space for them.
 +      */
 +      select_n_where_fields+= child->select_n_where_fields;
 +      /*
 +        Aggregate functions in having clause may add fields
 +        to an outer select. Count them also.
 +      */
 +      select_n_having_items+= child->select_n_having_items;
 +    }
 +}
 +
 +
 +bool LEX::main_select_push()
 +{
 +  DBUG_ENTER("LEX::main_select_push");
 +  current_select_number= 1;
 +  builtin_select.select_number= 1;
 +  if (push_select(&builtin_select))
 +    DBUG_RETURN(TRUE);
 +  DBUG_RETURN(FALSE);
 +}
 +
 +void Lex_select_lock::set_to(SELECT_LEX *sel)
 +{
 +  if (defined_lock)
 +  {
 +    if (sel->master_unit() &&
 +        sel == sel->master_unit()->fake_select_lex)
 +      sel->master_unit()->set_lock_to_the_last_select(*this);
 +    else
 +    {
 +      sel->parent_lex->safe_to_cache_query= 0;
 +      if (update_lock)
 +      {
 +        sel->lock_type= TL_WRITE;
-         sel->set_lock_for_tables(TL_WRITE);
++        sel->set_lock_for_tables(TL_WRITE, false);
 +      }
 +      else
 +      {
 +        sel->lock_type= TL_READ_WITH_SHARED_LOCKS;
-         sel->set_lock_for_tables(TL_READ_WITH_SHARED_LOCKS);
++        sel->set_lock_for_tables(TL_READ_WITH_SHARED_LOCKS, false);
 +      }
 +    }
 +  }
 +}
 +
 +bool Lex_order_limit_lock::set_to(SELECT_LEX *sel)
 +{
 +  /*TODO: lock */
 +  //if (lock.defined_lock && sel == sel->master_unit()->fake_select_lex)
 +  //  return TRUE;
 +  if (lock.defined_timeout)
 +  {
 +    THD *thd= sel->parent_lex->thd;
 +     if (set_statement_var_if_exists(thd,
 +                                     C_STRING_WITH_LEN("lock_wait_timeout"),
 +                                     lock.timeout) ||
 +         set_statement_var_if_exists(thd,
 +                                     C_STRING_WITH_LEN("innodb_lock_wait_timeout"),
 +                                     lock.timeout))
 +       return TRUE;
 +  }
 +  lock.set_to(sel);
 +  sel->explicit_limit= limit.explicit_limit;
 +  sel->select_limit= limit.select_limit;
 +  sel->offset_limit= limit.offset_limit;
 +  if (order_list)
 +  {
 +    if (sel->get_linkage() != GLOBAL_OPTIONS_TYPE &&
 +        sel->olap != UNSPECIFIED_OLAP_TYPE &&
 +        (sel->get_linkage() != UNION_TYPE || sel->braces))
 +    {
 +      my_error(ER_WRONG_USAGE, MYF(0),
 +          "CUBE/ROLLUP", "ORDER BY");
 +      return TRUE;
 +    }
 +    sel->order_list= *(order_list);
 +  }
 +  sel->is_set_query_expr_tail= true;
 +  return FALSE;
 +}
 +
 +
 +static void change_item_list_context(List<Item> *list,
 +                                     Name_resolution_context *context)
 +{
 +  List_iterator_fast<Item> it (*list);
 +  Item *item;
 +  while((item= it++))
 +  {
 +    item->walk(&Item::change_context_processor, FALSE, (void *)context);
 +  }
 +}
 +
 +
 +bool LEX::insert_select_hack(SELECT_LEX *sel)
 +{
 +  DBUG_ENTER("LEX::insert_select_hack");
 +
 +  DBUG_ASSERT(first_select_lex() == &builtin_select);
 +  DBUG_ASSERT(sel != NULL);
 +
 +  DBUG_ASSERT(builtin_select.first_inner_unit() == NULL);
 +
 +  if (builtin_select.link_prev)
 +  {
 +    if ((*builtin_select.link_prev= builtin_select.link_next))
 +      ((st_select_lex *)builtin_select.link_next)->link_prev=
 +        builtin_select.link_prev;
 +    builtin_select.link_prev= NULL; // indicator of removal
 +  }
 +
 +  set_main_unit(sel->master_unit());
 +
 +  DBUG_ASSERT(builtin_select.table_list.elements == 1);
 +  TABLE_LIST *insert_table= builtin_select.table_list.first;
 +
 +  if (!(insert_table->next_local= sel->table_list.first))
 +  {
 +    sel->table_list.next= &insert_table->next_local;
 +  }
 +  sel->table_list.first= insert_table;
 +  sel->table_list.elements++;
 +  insert_table->select_lex= sel;
 +
 +  sel->context.first_name_resolution_table= insert_table;
 +  builtin_select.context= sel->context;
 +  change_item_list_context(&field_list, &sel->context);
 +
 +  if (sel->tvc && !sel->next_select() &&
 +      (sql_command == SQLCOM_INSERT_SELECT ||
 +       sql_command == SQLCOM_REPLACE_SELECT))
 +  {
 +    DBUG_PRINT("info", ("'Usual' INSERT detected"));
 +    many_values= sel->tvc->lists_of_values;
 +    sel->options= sel->tvc->select_options;
 +    sel->tvc= NULL;
 +    if (sql_command == SQLCOM_INSERT_SELECT)
 +      sql_command= SQLCOM_INSERT;
 +    else
 +      sql_command= SQLCOM_REPLACE;
 +  }
 +
 +
 +  for (SELECT_LEX *sel= all_selects_list;
 +       sel;
 +       sel= sel->next_select_in_list())
 +  {
 +    if (sel->select_number != 1)
 +      sel->select_number--;
 +  };
 +
 +  DBUG_RETURN(FALSE);
 +}
 +
 +
 +/*
 +  Create an Item_singlerow_subselect for a query expression.
 +*/
 +Item *LEX::create_item_query_expression(THD *thd,
 +                                        const char *tok_start,
 +                                        st_select_lex_unit *unit)
 +{
 +  if (!expr_allows_subselect)
 +  {
 +    thd->parse_error(ER_SYNTAX_ERROR, tok_start);
 +    return NULL;
 +  }
 +
 +  // Add the subtree of subquery to the current SELECT_LEX
 +  SELECT_LEX *curr_sel= select_stack_head();
 +  DBUG_ASSERT(current_select == curr_sel);
 +  if (!curr_sel)
 +    curr_sel= &builtin_select;
 +  curr_sel->register_unit(unit, &curr_sel->context);
 +  curr_sel->add_statistics(unit);
 +
 +  return new (thd->mem_root)
 +    Item_singlerow_subselect(thd, unit->first_select());
 +}
 +
 +
 +/**
 +  Process unit parsed in brackets
 +*/
 +
 +bool LEX::parsed_unit_in_brackets(SELECT_LEX_UNIT *unit)
 +{
 +  SELECT_LEX *first_in_nest= unit->pre_last_parse->next_select()->first_nested;
 +  if (first_in_nest->first_nested != first_in_nest)
 +  {
 +    /* There is a priority jump starting from first_in_nest */
 +    if (create_priority_nest(first_in_nest) == NULL)
 +      return true;
 +    unit->fix_distinct();
 +  }
 +  push_select(unit->fake_select_lex);
 +  return false;
 +}
 +
 +
 +
 +/**
 +  Process tail of unit parsed in brackets
 +*/
 +SELECT_LEX *LEX::parsed_unit_in_brackets_tail(SELECT_LEX_UNIT *unit,
 +                                              Lex_order_limit_lock * l)
 +{
 +  pop_select();
 +  if (l)
 +  {
 +    (l)->set_to(unit->fake_select_lex);
 +  }
 +  return unit->first_select();
 +}
 +
 +
 +/**
 +  Process select parsed in brackets
 +*/
 +
 +SELECT_LEX *LEX::parsed_select(SELECT_LEX *sel, Lex_order_limit_lock * l)
 +{
 +  pop_select();
 +  if (l)
 +  {
 +    if (sel->next_select())
 +    {
 +      SELECT_LEX_UNIT *unit= sel->master_unit();
 +      if (!unit)
 +        unit= create_unit(sel);
 +      if (!unit)
 +        return NULL;
 +      if (!unit->fake_select_lex->is_set_query_expr_tail)
 +        l->set_to(unit->fake_select_lex);
 +      else
 +      {
 +        if (!l->order_list && !unit->fake_select_lex->explicit_limit)
 +        {
 +          sel= unit->fake_select_lex;
 +          l->order_list= &sel->order_list;
 +        }
 +        else
 +          sel= wrap_unit_into_derived(unit);
 +        if (!sel)
 +          return NULL;
 +        l->set_to(sel);
 +      }
 +    }
 +    else if (!sel->is_set_query_expr_tail)
 +    {
 +      l->set_to(sel);
 +    }
 +    else
 +    {
 +      if (!l->order_list && !sel->explicit_limit)
 +        l->order_list= &sel->order_list;
 +      else
 +      {
 +        SELECT_LEX_UNIT *unit= create_unit(sel);
 +        if (!unit)
 +          return NULL;
 +        sel= wrap_unit_into_derived(unit);
 +      }
 +      if (!sel)
 +        return NULL;
 +      l->set_to(sel);
 +    }
 +  }
 +  return sel;
 +}
 +
 +
 +/**
 +  Process select parsed in brackets
 +*/
 +
 +SELECT_LEX *LEX::parsed_select_in_brackets(SELECT_LEX *sel,
 +                                           Lex_order_limit_lock * l)
 +{
 +  sel->braces= TRUE;
 +  return parsed_select(sel, l);
 +}
 +
 +
 +SELECT_LEX_UNIT *LEX::parsed_select_expr_start(SELECT_LEX *s1, SELECT_LEX *s2,
 +                                               enum sub_select_type unit_type,
 +                                               bool distinct)
 +{
 +  SELECT_LEX_UNIT *res;
 +  SELECT_LEX *sel1;
 +  SELECT_LEX *sel2;
 +  if (!s1->next_select())
 +    sel1= s1;
 +  else
 +  {
 +    sel1= wrap_unit_into_derived(s1->master_unit());
 +    if (!sel1)
 +      return NULL;
 +  }
 +  if (!s2->next_select())
 +    sel2= s2;
 +  else
 +  {
 +    sel2= wrap_unit_into_derived(s2->master_unit());
 +    if (!sel2)
 +      return NULL;
 +  }
 +  sel1->link_neighbour(sel2);
 +  sel2->set_linkage_and_distinct(unit_type, distinct);
 +  sel2->first_nested= sel1->first_nested= sel1;
 +  res= create_unit(sel1);
 +  if (res == NULL)
 +    return NULL;
 +  res->pre_last_parse= sel1;
 +  return res;
 +}
 +
 +
 +SELECT_LEX_UNIT *LEX::parsed_select_expr_cont(SELECT_LEX_UNIT *unit,
 +                                              SELECT_LEX *s2,
 +                                              enum sub_select_type unit_type,
 +                                              bool distinct, bool oracle)
 +{
 +  SELECT_LEX *sel1;
 +  if (!s2->next_select())
 +    sel1= s2;
 +  else
 +  {
 +    sel1= wrap_unit_into_derived(s2->master_unit());
 +    if (!sel1)
 +      return NULL;
 +  }
 +  SELECT_LEX *last= unit->pre_last_parse->next_select();
 +
 +  int cmp= oracle? 0 : cmp_unit_op(unit_type, last->get_linkage());
 +  if (cmp == 0)
 +  {
 +    sel1->first_nested= last->first_nested;
 +  }
 +  else if (cmp > 0)
 +  {
 +    last->first_nested= unit->pre_last_parse;
 +    sel1->first_nested= last;
 +  }
 +  else /* cmp < 0 */
 +  {
 +    SELECT_LEX *first_in_nest= last->first_nested;
 +    if (first_in_nest->first_nested != first_in_nest)
 +    {
 +      /* There is a priority jump starting from first_in_nest */
 +      if ((last= create_priority_nest(first_in_nest)) == NULL)
 +        return NULL;
 +      unit->fix_distinct();
 +    }
 +    sel1->first_nested= last->first_nested;
 +  }
 +  last->link_neighbour(sel1);
 +  sel1->set_master_unit(unit);
 +  sel1->set_linkage_and_distinct(unit_type, distinct);
 +  unit->pre_last_parse= last;
 +  return unit;
 +}
 +
 +/**
 +  Process parsed select in body
 +*/
 +
 +SELECT_LEX_UNIT *LEX::parsed_body_select(SELECT_LEX *sel,
 +                                         Lex_order_limit_lock * l)
 +{
 +  if (!(sel= parsed_select(sel, l)))
 +    return NULL;
 +
 +  SELECT_LEX_UNIT *res= create_unit(sel);
++  if (res && sel->tvc && sel->order_list.elements)
++  {
++    if (res->add_fake_select_lex(thd))
++      return NULL;
++    SELECT_LEX *fake= res->fake_select_lex;
++    fake->order_list= sel->order_list;
++    fake->explicit_limit= sel->explicit_limit;
++    fake->select_limit= sel->select_limit;
++    fake->offset_limit= sel->offset_limit;
++  }
 +  return res;
 +}
 +
 +/**
 +  Process parsed unit in body
 +*/
 +
 +bool LEX::parsed_body_unit(SELECT_LEX_UNIT *unit)
 +{
 +  SELECT_LEX *first_in_nest=
 +    unit->pre_last_parse->next_select()->first_nested;
 +  if (first_in_nest->first_nested != first_in_nest)
 +  {
 +    /* There is a priority jump starting from first_in_nest */
 +    if (create_priority_nest(first_in_nest) == NULL)
 +      return true;
 +    unit->fix_distinct();
 +  }
 +  push_select(unit->fake_select_lex);
 +  return false;
 +}
 +
 +/**
 +  Process parsed tail of unit in body
 +
 +  TODO: make processing for double tail case
 +*/
 +
 +SELECT_LEX_UNIT *LEX::parsed_body_unit_tail(SELECT_LEX_UNIT *unit,
 +                                            Lex_order_limit_lock * l)
 +{
 +  pop_select();
 +  if (l)
 +  {
 +    (l)->set_to(unit->fake_select_lex);
 +  }
 +  return unit;
 +}
 +
 +/**
 +  Process subselect parsing
 +*/
 +
 +SELECT_LEX *LEX::parsed_subselect(SELECT_LEX_UNIT *unit, char *place)
 +{
 +  if (!expr_allows_subselect)
 +  {
 +    thd->parse_error(ER_SYNTAX_ERROR, place);
 +    return NULL;
 +  }
 +
 +  // Add the subtree of subquery to the current SELECT_LEX
 +  SELECT_LEX *curr_sel= select_stack_head();
 +  DBUG_ASSERT(current_select == curr_sel);
 +  if (curr_sel)
 +  {
 +    curr_sel->register_unit(unit, &curr_sel->context);
 +    curr_sel->add_statistics(unit);
 +  }
 +
 +  return unit->first_select();
 +}
 +
 +
 +
 +/**
 +  Process INSERT-like select
 +*/
 +
 +bool LEX::parsed_insert_select(SELECT_LEX *first_select)
 +{
 +  if (sql_command == SQLCOM_INSERT ||
 +      sql_command == SQLCOM_REPLACE)
 +  {
 +    if (sql_command == SQLCOM_INSERT)
 +      sql_command= SQLCOM_INSERT_SELECT;
 +    else
 +      sql_command= SQLCOM_REPLACE_SELECT;
 +  }
 +  insert_select_hack(first_select);
 +  if (check_main_unit_semantics())
 +    return true;
 +
 +  // fix "main" select
 +  SELECT_LEX *blt __attribute__((unused))= pop_select();
 +  DBUG_ASSERT(blt == &builtin_select);
 +  push_select(first_select);
 +  return false;
 +}
 +
 +
 +bool LEX::parsed_TVC_start()
 +{
 +  SELECT_LEX *sel;
 +  many_values.empty();
 +  insert_list= 0;
 +  if (!(sel= alloc_select(TRUE)) ||
 +        push_select(sel))
 +    return true;
 +  sel->init_select();
 +  sel->braces= FALSE; // just initialisation
 +  return false;
 +}
 +
 +
 +SELECT_LEX *LEX::parsed_TVC_end()
 +{
 +
 +  SELECT_LEX *res= pop_select(); // above TVC select
 +  if (!(res->tvc=
 +        new (thd->mem_root) table_value_constr(many_values,
 +          res,
 +          res->options)))
 +    return NULL;
 +  many_values.empty();
 +  return res;
 +}
 +
 +
 +TABLE_LIST *LEX::parsed_derived_select(SELECT_LEX *sel, int for_system_time,
 +                                       LEX_CSTRING *alias)
 +{
 +  TABLE_LIST *res;
 +  derived_tables|= DERIVED_SUBQUERY;
 +  sel->set_linkage(DERIVED_TABLE_TYPE);
 +  sel->braces= FALSE;
 +  // Add the subtree of subquery to the current SELECT_LEX
 +  SELECT_LEX *curr_sel= select_stack_head();
 +  DBUG_ASSERT(current_select == curr_sel);
 +  SELECT_LEX_UNIT *unit= sel->master_unit();
 +  if (!unit)
 +  {
 +    unit= create_unit(sel);
 +    if (!unit)
 +      return NULL;
 +  }
 +  curr_sel->register_unit(unit, &curr_sel->context);
 +  curr_sel->add_statistics(unit);
 +
 +  Table_ident *ti= new (thd->mem_root) Table_ident(unit);
 +  if (ti == NULL)
 +    return NULL;
 +  if (!(res= curr_sel->add_table_to_list(thd, ti, alias, 0,
 +                                         TL_READ, MDL_SHARED_READ)))
 +    return NULL;
 +  if (for_system_time)
 +  {
 +    res->vers_conditions= vers_conditions;
 +  }
 +  return res;
 +}
 +
 +TABLE_LIST *LEX::parsed_derived_unit(SELECT_LEX_UNIT *unit,
 +                                     int for_system_time,
 +                                     LEX_CSTRING *alias)
 +{
 +  TABLE_LIST *res;
 +  derived_tables|= DERIVED_SUBQUERY;
 +  unit->first_select()->set_linkage(DERIVED_TABLE_TYPE);
 +
 +  // Add the subtree of subquery to the current SELECT_LEX
 +  SELECT_LEX *curr_sel= select_stack_head();
 +  DBUG_ASSERT(current_select == curr_sel);
 +  curr_sel->register_unit(unit, &curr_sel->context);
 +  curr_sel->add_statistics(unit);
 +
 +  Table_ident *ti= new (thd->mem_root) Table_ident(unit);
 +  if (ti == NULL)
 +    return NULL;
 +  if (!(res= curr_sel->add_table_to_list(thd, ti, alias, 0,
 +                                         TL_READ, MDL_SHARED_READ)))
 +    return NULL;
 +  if (for_system_time)
 +  {
 +    res->vers_conditions= vers_conditions;
 +  }
 +  return res;
 +}
 +
 +bool LEX::parsed_create_view(SELECT_LEX_UNIT *unit, int check)
 +{
 +  SQL_I_List<TABLE_LIST> *save= &first_select_lex()->table_list;
 +  set_main_unit(unit);
 +  if (check_main_unit_semantics())
 +    return true;
 +  first_select_lex()->table_list.push_front(save);
 +  current_select= first_select_lex();
 +  size_t len= thd->m_parser_state->m_lip.get_cpp_ptr() -
 +    create_view->select.str;
 +  void *create_view_select= thd->memdup(create_view->select.str, len);
 +  create_view->select.length= len;
 +  create_view->select.str= (char *) create_view_select;
 +  size_t not_used;
 +  trim_whitespace(thd->charset(),
 +      &create_view->select, &not_used);
 +  create_view->check= check;
 +  parsing_options.allows_variable= TRUE;
 +  return false;
 +}
 +
 +bool LEX::select_finalize(st_select_lex_unit *expr)
 +{
 +  sql_command= SQLCOM_SELECT;
 +  selects_allow_into= TRUE;
 +  selects_allow_procedure= TRUE;
 +  set_main_unit(expr);
 +  return check_main_unit_semantics();
 +}
 +
 +
 +/*
 +  "IN" and "EXISTS" subselect can appear in two statement types:
 +
 +  1. Statements that can have table columns, such as SELECT, DELETE, UPDATE
 +  2. Statements that cannot have table columns, e.g:
 +     RETURN ((1) IN (SELECT * FROM t1))
 +     IF ((1) IN (SELECT * FROM t1))
 +
 +  Statements of the first type call master_select_push() in the beginning.
 +  In such case everything is properly linked.
 +
 +  Statements of the second type do not call mastr_select_push().
 +  Here we catch the second case and relink thd->lex->builtin_select and
 +  select_lex to properly point to each other.
 +
 +  QQ: Shouldn't subselects of other type also call relink_hack()?
 +  QQ: Can we do it at constructor time instead?
 +*/
 +
 +void LEX::relink_hack(st_select_lex *select_lex)
 +{
 +  if (!select_stack_top) // Statements of the second type
 +  {
 +    if (!select_lex->get_master()->get_master())
 +      ((st_select_lex *) select_lex->get_master())->
 +        set_master(&builtin_select);
 +    if (!builtin_select.get_slave())
 +      builtin_select.set_slave(select_lex->get_master());
 +  }
 +}
 +
 +
 +
 +bool SELECT_LEX_UNIT::set_lock_to_the_last_select(Lex_select_lock l)
 +{
 +  if (l.defined_lock)
 +  {
 +    SELECT_LEX *sel= first_select();
 +    while (sel->next_select())
 +      sel= sel->next_select();
 +    if (sel->braces)
 +    {
 +      my_error(ER_WRONG_USAGE, MYF(0), "lock options",
 +               "End SELECT expression");
 +      return TRUE;
 +    }
 +    l.set_to(sel);
 +  }
 +  return FALSE;
 +}
 +
 +/**
 +  Generate unique name for generated derived table for this SELECT
 +*/
 +
 +bool SELECT_LEX::make_unique_derived_name(THD *thd, LEX_CSTRING *alias)
 +{
 +  // uint32 digits + two underscores + trailing '\0'
 +  char buff[MAX_INT_WIDTH + 2 + 1];
 +  alias->length= my_snprintf(buff, sizeof(buff), "__%u", select_number);
 +  alias->str= thd->strmake(buff, alias->length);
 +  return !alias->str;
 +}
 +
 +
 +/*
 +  Make a new sp_instr_stmt and set its m_query to a concatenation
 +  of two strings.
 +*/
 +bool LEX::new_sp_instr_stmt(THD *thd,
 +                            const LEX_CSTRING &prefix,
 +                            const LEX_CSTRING &suffix)
 +{
 +  LEX_STRING qbuff;
 +  sp_instr_stmt *i;
 +
 +  if (!(i= new (thd->mem_root) sp_instr_stmt(sphead->instructions(),
 +                                             spcont, this)))
 +    return true;
 +
 +  qbuff.length= prefix.length + suffix.length;
 +  if (!(qbuff.str= (char*) alloc_root(thd->mem_root, qbuff.length + 1)))
 +    return true;
 +  memcpy(qbuff.str, prefix.str, prefix.length);
 +  strmake(qbuff.str + prefix.length, suffix.str, suffix.length);
 +  i->m_query= qbuff;
 +  return sphead->add_instr(i);
 +}
 +
 +
 +bool LEX::sp_proc_stmt_statement_finalize_buf(THD *thd, const LEX_CSTRING &qbuf)
 +{
 +  sphead->m_flags|= sp_get_flags_for_command(this);
 +  /* "USE db" doesn't work in a procedure */
 +  if (unlikely(sql_command == SQLCOM_CHANGE_DB))
 +  {
 +    my_error(ER_SP_BADSTATEMENT, MYF(0), "USE");
 +    return true;
 +  }
 +  /*
 +    Don't add an instruction for SET statements, since all
 +    instructions for them were already added during processing
 +    of "set" rule.
 +  */
 +  DBUG_ASSERT(sql_command != SQLCOM_SET_OPTION || var_list.is_empty());
 +  if (sql_command != SQLCOM_SET_OPTION)
 +    return new_sp_instr_stmt(thd, empty_clex_str, qbuf);
 +  return false;
 +}
 +
 +
 +bool LEX::sp_proc_stmt_statement_finalize(THD *thd, bool no_lookahead)
 +{
 +  // Extract the query statement from the tokenizer
 +  Lex_input_stream *lip= &thd->m_parser_state->m_lip;
 +  Lex_cstring qbuf(sphead->m_tmp_query, no_lookahead ? lip->get_ptr() :
 +                                                       lip->get_tok_start());
 +  return LEX::sp_proc_stmt_statement_finalize_buf(thd, qbuf);
 +}
 +
 +
 +/**
 +  @brief
 +    Extract the condition that can be pushed into WHERE clause
 +
 +  @param thd             the thread handle
 +  @param cond            the condition from which to extract a pushed condition
 +  @param remaining_cond  IN/OUT the condition that will remain of cond after
 +                         the extraction
 +  @param transformer     the transformer callback function to be
 +                         applied to the fields of the condition so it
 +                         can be pushed`
 +  @param arg             parameter to be passed to the transformer
 +
 +  @details
 +    This function builds the most restrictive condition depending only on
 +    the fields used in the GROUP BY of this SELECT. These fields were
 +    collected before in grouping_tmp_fields list of this SELECT.
 +
 +    First this method checks if this SELECT doesn't have any aggregation
 +    functions and has no GROUP BY clause. If so cond can be entirely pushed
 +    into WHERE.
 +
 +    Otherwise the method checks if there is a condition depending only on
 +    grouping fields that can be extracted from cond.
 +
 +    The condition that can be pushed into WHERE should be transformed.
 +    It is done by transformer.
 +
 +    The extracted condition is saved in cond_pushed_into_where of this select.
 +    cond can remain un empty after the extraction of the condition that can be
 +    pushed into WHERE. It is saved in remaining_cond.
 +
 +  @note
 +    This method is called for pushdown conditions into materialized
 +    derived tables/views optimization.
 +    Item::derived_field_transformer_for_where is passed as the actual
 +    callback function.
 +    Also it is called for pushdown into materialized IN subqueries.
 +    Item::in_subq_field_transformer_for_where is passed as the actual
 +    callback function.
 +*/
 +
 +void st_select_lex::pushdown_cond_into_where_clause(THD *thd, Item *cond,
 +                                                    Item **remaining_cond,
 +                                                    Item_transformer transformer,
 +                                                    uchar *arg)
 +{
 +  if (!cond_pushdown_is_allowed())
 +    return;
 +  thd->lex->current_select= this;
 +  if (have_window_funcs())
 +  {
 +    Item *cond_over_partition_fields;
 +    check_cond_extraction_for_grouping_fields(thd, cond);
 +    cond_over_partition_fields=
 +      build_cond_for_grouping_fields(thd, cond, true);
 +    if (cond_over_partition_fields)
 +      cond_over_partition_fields= cond_over_partition_fields->transform(thd,
 +                                &Item::grouping_field_transformer_for_where,
 +                                (uchar*) this);
 +    if (cond_over_partition_fields)
 +    {
 +      cond_over_partition_fields->walk(
 +        &Item::cleanup_excluding_const_fields_processor, 0, 0);
 +      cond_pushed_into_where= cond_over_partition_fields;
 +    }
 +
 +    return;
 +  }
 +
 +  if (!join->group_list && !with_sum_func)
 +  {
 +    cond=
 +      cond->transform(thd, transformer, arg);
 +    if (cond)
 +    {
 +      cond->walk(
 +        &Item::cleanup_excluding_const_fields_processor, 0, 0);
 +      cond_pushed_into_where= cond;
 +    }
 +
 +    return;
 +  }
 +
 +  /*
 +    Figure out what can be extracted from cond and pushed into
 +    the WHERE clause of this select.
 +  */
 +  Item *cond_over_grouping_fields;
 +  check_cond_extraction_for_grouping_fields(thd, cond);
 +  cond_over_grouping_fields=
 +    build_cond_for_grouping_fields(thd, cond, true);
 +
 +  /*
 +    Transform references to the columns of condition that can be pushed
 +    into WHERE so it can be pushed.
 +  */
 +  if (cond_over_grouping_fields)
 +    cond_over_grouping_fields= cond_over_grouping_fields->transform(thd,
 +                            &Item::grouping_field_transformer_for_where,
 +                            (uchar*) this);
 +
 +  if (cond_over_grouping_fields)
 +  {
 +
 +    /*
 +      Remove top conjuncts in cond that has been pushed into the WHERE
 +      clause of this select
 +    */
 +    cond= remove_pushed_top_conjuncts(thd, cond);
 +
 +    cond_over_grouping_fields->walk(
 +      &Item::cleanup_excluding_const_fields_processor, 0, 0);
 +    cond_pushed_into_where= cond_over_grouping_fields;
 +  }
 +
 +  *remaining_cond= cond;
 +}
 +
 +
 +/**
 +  @brief
 +    Mark OR-conditions as non-pushable to avoid repeatable pushdown
 +
 +  @param cond  the processed condition
 +
 +  @details
 +    Consider pushdown into the materialized derived table/view.
 +    Consider OR condition that can be pushed into HAVING and some
 +    parts of this OR condition that can be pushed into WHERE.
 +
 +    On example:
 +
 +    SELECT *
 +    FROM t1,
 +    (
 +      SELECT a,MAX(c) AS m_c
 +      GROUP BY a
 +    ) AS dt
 +    WHERE ((dt.m_c>10) AND (dt.a>2)) OR ((dt.m_c<7) and (dt.a<3)) AND
 +          (t1.a=v1.a);
 +
 +
 +    Here ((dt.m_c>10) AND (dt.a>2)) OR ((dt.m_c<7) and (dt.a<3)) or1
 +    can be pushed down into the HAVING of the materialized
 +    derived table dt.
 +
 +    (dt.a>2) OR (dt.a<3) part of or1 depends only on grouping fields
 +    of dt and can be pushed into WHERE.
 +
 +    As a result:
 +
 +    SELECT *
 +    FROM t1,
 +    (
 +      SELECT a,MAX(c) AS m_c
 +      WHERE (dt.a>2) OR (dt.a<3)
 +      GROUP BY a
 +      HAVING ((dt.m_c>10) AND (dt.a>2)) OR ((dt.m_c<7) and (dt.a<3))
 +    ) AS dt
 +    WHERE ((dt.m_c>10) AND (dt.a>2)) OR ((dt.m_c<7) and (dt.a<3)) AND
 +          (t1.a=v1.a);
 +
 +
 +    Here (dt.a>2) OR (dt.a<3) also remains in HAVING of dt.
 +    When SELECT that defines df is processed HAVING pushdown optimization
 +    is made. In HAVING pushdown optimization it will extract
 +    (dt.a>2) OR (dt.a<3) condition from or1 again and push it into WHERE.
 +    This will cause duplicate conditions in WHERE of dt.
 +
 +    To avoid repeatable pushdown such OR conditions as or1 describen
 +    above are marked with NO_EXTRACTION_FL.
 +
 +  @note
 +    This method is called for pushdown into materialized
 +    derived tables/views/IN subqueries optimization.
 +*/
 +
 +void mark_or_conds_to_avoid_pushdown(Item *cond)
 +{
 +  if (cond->type() == Item::COND_ITEM &&
 +      ((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
 +  {
 +    List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
 +    Item *item;
 +    while ((item=li++))
 +    {
 +      if (item->type() == Item::COND_ITEM &&
 +          ((Item_cond*) item)->functype() == Item_func::COND_OR_FUNC)
 +        item->set_extraction_flag(NO_EXTRACTION_FL);
 +    }
 +  }
 +  else if (cond->type() == Item::COND_ITEM &&
 +          ((Item_cond*) cond)->functype() == Item_func::COND_OR_FUNC)
 +    cond->set_extraction_flag(NO_EXTRACTION_FL);
 +}
 +
 +/**
 +  @brief
 +    Get condition that can be pushed from HAVING into WHERE
 +
 +  @param thd   the thread handle
 +  @param cond  the condition from which to extract the condition
 +
 +  @details
 +    The method collects in attach_to_conds list conditions from cond
 +    that can be pushed from HAVING into WHERE.
 +
 +    Conditions that can be pushed were marked with FULL_EXTRACTION_FL in
 +    check_cond_extraction_for_grouping_fields() method.
 +    Conditions that can't be pushed were marked with NO_EXTRACTION_FL.
 +    Conditions which parts can be pushed weren't marked.
 +
 +    There are two types of conditions that can be pushed:
 +    1. Condition that can be simply moved from HAVING
 +       (if cond is marked with FULL_EXTRACTION_FL or
 +           cond is an AND condition and some of its parts are marked with
 +           FULL_EXTRACTION_FL)
 +       In this case condition is transformed and pushed into attach_to_conds
 +       list.
 +    2. Part of some other condition c1 that can't be entirely pushed
 +       (if с1 isn't marked with any flag).
 +
 +       For example:
 +
 +       SELECT t1.a,MAX(t1.b),t1.c
 +       FROM t1
 +       GROUP BY t1.a
 +       HAVING ((t1.a > 5) AND (t1.c < 3)) OR (t1.a = 3);
 +
 +       Here (t1.a > 5) OR (t1.a = 3) from HAVING can be pushed into WHERE.
 +
 +       In this case build_pushable_cond() is called for c1.
 +       This method builds a clone of the c1 part that can be pushed.
 +
 +    Transformation mentioned above is made with multiple_equality_transformer
 +    transformer. It transforms all multiple equalities in the extracted
 +    condition into the set of equalities.
 +
 +  @note
 +    Conditions that can be pushed are collected in attach_to_conds in this way:
 +    1. if cond is an AND condition its parts that can be pushed into WHERE
 +       are added to attach_to_conds list separately.
 +    2. in all other cases conditions are pushed into the list entirely.
 +
 +  @retval
 +    true  - if an error occurs
 +    false - otherwise
 +*/
 +
 +bool
 +st_select_lex::build_pushable_cond_for_having_pushdown(THD *thd, Item *cond)
 +{
 +  List<Item> equalities;
 +
 +  /* Condition can't be pushed */
 +  if (cond->get_extraction_flag() == NO_EXTRACTION_FL)
 +    return false;
 +
 +  /**
 +    Condition can be pushed entirely.
 +    Transform its multiple equalities and add to attach_to_conds list.
 +  */
 +  if (cond->get_extraction_flag() == FULL_EXTRACTION_FL)
 +  {
 +    Item *result= cond->transform(thd,
 +                                  &Item::multiple_equality_transformer,
 +                                  (uchar *)this);
 +    if (!result)
 +      return true;
 +    if (result->type() == Item::COND_ITEM &&
 +        ((Item_cond*) result)->functype() == Item_func::COND_AND_FUNC)
 +    {
 +      List_iterator<Item> li(*((Item_cond*) result)->argument_list());
 +      Item *item;
 +      while ((item=li++))
 +      {
 +        if (attach_to_conds.push_back(item, thd->mem_root))
 +          return true;
 +      }
 +    }
 +    else
 +    {
 +      if (attach_to_conds.push_back(result, thd->mem_root))
 +        return true;
 +    }
 +    return false;
 +  }
 +
 +  /**
 +    There is no flag set for this condition. It means that some
 +    part of this condition can be pushed.
 +  */
 +  if (cond->type() != Item::COND_ITEM)
 +    return false;
 +  if (((Item_cond *)cond)->functype() != Item_cond::COND_AND_FUNC)
 +  {
 +    Item *fix= cond->build_pushable_cond(thd, 0, 0);
 +    if (!fix)
 +      return false;
 +    if (attach_to_conds.push_back(fix, thd->mem_root))
 +      return true;
 +  }
 +  else
 +  {
 +    List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
 +    Item *item;
 +    while ((item=li++))
 +    {
 +      if (item->get_extraction_flag() == NO_EXTRACTION_FL)
 +        continue;
 +      else if (item->get_extraction_flag() == FULL_EXTRACTION_FL)
 +      {
 +        Item *result= item->transform(thd,
 +                                      &Item::multiple_equality_transformer,
 +                                      (uchar *)item);
 +
 +        if (!result)
 +          return true;
 +        if (result->type() == Item::COND_ITEM &&
 +           ((Item_cond*) result)->functype() == Item_func::COND_AND_FUNC)
 +        {
 +          List_iterator<Item> li(*((Item_cond*) result)->argument_list());
 +          Item *item;
 +          while ((item=li++))
 +          {
 +            if (attach_to_conds.push_back(item, thd->mem_root))
 +              return true;
 +          }
 +        }
 +        else
 +        {
 +          if (attach_to_conds.push_back(result, thd->mem_root))
 +            return true;
 +        }
 +      }
 +      else
 +      {
 +        Item *fix= item->build_pushable_cond(thd, 0, 0);
 +        if (!fix)
 +          continue;
 +        if (attach_to_conds.push_back(fix, thd->mem_root))
 +          return true;
 +      }
 +    }
 +  }
 +  return false;
 +}
 +
 +
 +/**
 +  Check if item is equal to some field in Field_pair 'field_pair'
 +  from 'pair_list' and return found 'field_pair' if it exists.
 +*/
 +
 +Field_pair *get_corresponding_field_pair(Item *item,
 +                                         List<Field_pair> pair_list)
 +{
 +  DBUG_ASSERT(item->type() == Item::FIELD_ITEM ||
 +              (item->type() == Item::REF_ITEM &&
 +               ((((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF) ||
 +               (((Item_ref *) item)->ref_type() == Item_ref::REF))));
 +
 +  List_iterator<Field_pair> it(pair_list);
 +  Field_pair *field_pair;
 +  Item_field *field_item= (Item_field *) (item->real_item());
 +  while ((field_pair= it++))
 +  {
 +    if (field_item->field == field_pair->field)
 +      return field_pair;
 +  }
 +  return NULL;
 +}
 +
 +
 +/**
 +  @brief
 +    Collect fields from multiple equalities which are equal to grouping
 +
 +  @param thd  the thread handle
 +
 +  @details
 +    This method checks if multiple equalities of the WHERE clause contain
 +    fields from GROUP BY of this SELECT. If so all fields of such multiple
 +    equalities are collected in grouping_tmp_fields list without repetitions.
 +
 +  @retval
 +    true  - if an error occurs
 +    false - otherwise
 +*/
 +
 +bool st_select_lex::collect_fields_equal_to_grouping(THD *thd)
 +{
 +  if (!join->cond_equal || join->cond_equal->is_empty())
 +    return false;
 +
 +  List_iterator_fast<Item_equal> li(join->cond_equal->current_level);
 +  Item_equal *item_equal;
 +
 +  while ((item_equal= li++))
 +  {
 +    Item_equal_fields_iterator it(*item_equal);
 +    Item *item;
 +    while ((item= it++))
 +    {
 +      if (get_corresponding_field_pair(item, grouping_tmp_fields))
 +        break;
 +    }
 +    if (!item)
 +      break;
 +
 +    it.rewind();
 +    while ((item= it++))
 +    {
 +      if (get_corresponding_field_pair(item, grouping_tmp_fields))
 +        continue;
 +      Field_pair *grouping_tmp_field=
 +        new Field_pair(((Item_field *)item->real_item())->field, item);
 +      if (grouping_tmp_fields.push_back(grouping_tmp_field, thd->mem_root))
 +        return true;
 +    }
 +  }
 +  return false;
 +}
 +
 +
 +/**
 +  @brief
 +    Remove marked top conjuncts of HAVING for having pushdown
 +
 +  @param thd   the thread handle
 +  @param cond  the condition which subformulas are to be removed
 +
 +  @details
 +    This method removes from cond all subformulas that can be moved from HAVING
 +    into WHERE.
 +
 +  @retval
 +     condition without removed subformulas
 +     0 if the whole 'cond' is removed
 +*/
 +
 +Item *remove_pushed_top_conjuncts_for_having(THD *thd, Item *cond)
 +{
 +  /* Nothing to extract */
 +  if (cond->get_extraction_flag() == NO_EXTRACTION_FL)
 +  {
 +    cond->clear_extraction_flag();
 +    return cond;
 +  }
 +  /* cond can be pushed in WHERE entirely */
 +  if (cond->get_extraction_flag() == FULL_EXTRACTION_FL)
 +  {
 +    cond->clear_extraction_flag();
 +    return 0;
 +  }
 +
 +  /* Some parts of cond can be pushed */
 +  if (cond->type() == Item::COND_ITEM &&
 +      ((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
 +  {
 +    List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
 +    Item *item;
 +    while ((item=li++))
 +    {
 +      if (item->get_extraction_flag() == NO_EXTRACTION_FL)
 +        item->clear_extraction_flag();
 +      else if (item->get_extraction_flag() == FULL_EXTRACTION_FL)
 +      {
 +        if (item->type() == Item::FUNC_ITEM &&
 +            ((Item_func*) item)->functype() == Item_func::MULT_EQUAL_FUNC)
 +          item->set_extraction_flag(DELETION_FL);
 +        else
 +        {
 +          item->clear_extraction_flag();
 +          li.remove();
 +        }
 +      }
 +    }
 +    switch (((Item_cond*) cond)->argument_list()->elements)
 +    {
 +    case 0:
 +      return 0;
 +    case 1:
 +      return (((Item_cond*) cond)->argument_list()->head());
 +    default:
 +      return cond;
 +    }
 +  }
 +  return cond;
 +}
 +
 +
 +/**
 +  @brief
 +    Extract condition that can be pushed from HAVING into WHERE
 +
 +  @param thd           the thread handle
 +  @param having        the HAVING clause of this select
 +  @param having_equal  multiple equalities of HAVING
 +
 +  @details
 +    This method builds a set of conditions dependent only on
 +    fields used in the GROUP BY of this select (directly or indirectly
 +    through equalities). These conditions are extracted from the HAVING
 +    clause of this select.
 +    The method saves these conditions into attach_to_conds list and removes
 +    from HAVING conditions that can be entirely pushed into WHERE.
 +
 +    Example of the HAVING pushdown transformation:
 +
 +    SELECT t1.a,MAX(t1.b)
 +    FROM t1
 +    GROUP BY t1.a
 +    HAVING (t1.a>2) AND (MAX(c)>12);
 +
 +    =>
 +
 +    SELECT t1.a,MAX(t1.b)
 +    FROM t1
 +    WHERE (t1.a>2)
 +    GROUP BY t1.a
 +    HAVING (MAX(c)>12);
 +
 +    In this method (t1.a>2) is not attached to the WHERE clause.
 +    It is pushed into the attach_to_conds list to be attached to
 +    the WHERE clause later.
 +
 +    In details:
 +    1. Collect fields used in the GROUP BY grouping_fields of this SELECT
 +    2. Collect fields equal to grouping_fields from the WHERE clause
 +       of this SELECT and add them to the grouping_fields list.
 +    3. Extract the most restrictive condition from the HAVING clause of this
 +       select that depends only on the grouping fields (directly or indirectly
 +       through equality).
 +       If the extracted condition is an AND condition it is transformed into a
 +       list of all its conjuncts saved in attach_to_conds. Otherwise,
 +       the condition is put into attach_to_conds as the only its element.
 +    4. Remove conditions from HAVING clause that can be entirely pushed
 +       into WHERE.
 +       Multiple equalities are not removed but marked with DELETION_FL flag.
 +       They will be deleted later in substitite_for_best_equal_field() called
 +       for the HAVING condition.
 +    5. Unwrap fields wrapped in Item_ref wrappers contained in the condition
 +       of attach_to_conds so the condition could be pushed into WHERE.
 +
 +  @note
 +    This method is similar to st_select_lex::pushdown_cond_into_where_clause().
 +
 +  @retval TRUE   if an error occurs
 +  @retval FALSE  otherwise
 +*/
 +
 +Item *st_select_lex::pushdown_from_having_into_where(THD *thd, Item *having)
 +{
 +  if (!having || !group_list.first)
 +    return having;
 +  if (!cond_pushdown_is_allowed())
 +    return having;
 +
 +  st_select_lex *save_curr_select= thd->lex->current_select;
 +  thd->lex->current_select= this;
 +
 +  /*
 +    1. Collect fields used in the GROUP BY grouping fields of this SELECT
 +    2. Collect fields equal to grouping_fields from the WHERE clause
 +       of this SELECT and add them to the grouping fields list.
 +  */
 +  if (collect_grouping_fields(thd) ||
 +      collect_fields_equal_to_grouping(thd))
 +    return having;
 +
 +  /*
 +    3. Extract the most restrictive condition from the HAVING clause of this
 +       select that depends only on the grouping fields (directly or indirectly
 +       through equality).
 +       If the extracted condition is an AND condition it is transformed into a
 +       list of all its conjuncts saved in attach_to_conds. Otherwise,
 +       the condition is put into attach_to_conds as the only its element.
 +  */
 +  List_iterator_fast<Item> it(attach_to_conds);
 +  Item *item;
 +  check_cond_extraction_for_grouping_fields(thd, having);
 +  if (build_pushable_cond_for_having_pushdown(thd, having))
 +  {
 +    attach_to_conds.empty();
 +    goto exit;
 +  }
 +  if (!attach_to_conds.elements)
 +    goto exit;
 +
 +  /*
 +    4. Remove conditions from HAVING clause that can be entirely pushed
 +       into WHERE.
 +       Multiple equalities are not removed but marked with DELETION_FL flag.
 +       They will be deleted later in substitite_for_best_equal_field() called
 +       for the HAVING condition.
 +  */
 +  having= remove_pushed_top_conjuncts_for_having(thd, having);
 +
 +  /*
 +    Change join->cond_equal which points to the multiple equalities of
 +    the top level of HAVING.
 +    Removal of AND conditions may leave only one conjunct in HAVING.
 +
 +    Example 1:
 +    SELECT *
 +    FROM t1
 +    GROUP BY t1.a
 +    (t1.a < 2) AND (t1.b = 2)
 +
 +    (t1.a < 2) is pushed into WHERE.
 +    join->cond_equal should point on (t1.b = 2) multiple equality now.
 +
 +    Example 2:
 +    SELECT *
 +    FROM t1
 +    GROUP BY t1.a
 +    (t1.a = 2) AND (t1.b < 2)
 +
 +    (t1.a = 2) is pushed into WHERE.
 +    join->cond_equal should be NULL now.
 +  */
 +  if (having &&
 +      having->type() == Item::FUNC_ITEM &&
 +      ((Item_func*) having)->functype() == Item_func::MULT_EQUAL_FUNC)
 +    join->having_equal= new (thd->mem_root) COND_EQUAL((Item_equal *)having,
 +                                                       thd->mem_root);
 +  else if (!having ||
 +           having->type() != Item::COND_ITEM ||
 +           ((Item_cond *)having)->functype() != Item_cond::COND_AND_FUNC)
 +    join->having_equal= 0;
 +
 +  /*
 +    5. Unwrap fields wrapped in Item_ref wrappers contained in the condition
 +       of attach_to_conds so the condition could be pushed into WHERE.
 +  */
 +  it.rewind();
 +  while ((item=it++))
 +  {
 +    item= item->transform(thd,
 +                          &Item::field_transformer_for_having_pushdown,
 +                          (uchar *)this);
 +
 +    if (item->walk(&Item:: cleanup_processor, 0, STOP_PTR) ||
 +        item->fix_fields(thd, NULL))
 +    {
 +      attach_to_conds.empty();
 +      goto exit;
 +    }
 +  }
 +exit:
 +  thd->lex->current_select= save_curr_select;
 +  return having;
 +}
 +
 +
 +bool LEX::stmt_install_plugin(const DDL_options_st &opt,
 +                              const Lex_ident_sys_st &name,
 +                              const LEX_CSTRING &soname)
 +{
 +  create_info.init();
 +  if (add_create_options_with_check(opt))
 +    return true;
 +  sql_command= SQLCOM_INSTALL_PLUGIN;
 +  comment= name;
 +  ident= soname;
 +  return false;
 +}
 +
 +
 +void LEX::stmt_install_plugin(const LEX_CSTRING &soname)
 +{
 +  sql_command= SQLCOM_INSTALL_PLUGIN;
 +  comment= null_clex_str;
 +  ident= soname;
 +}
 +
 +
 +bool LEX::stmt_uninstall_plugin_by_name(const DDL_options_st &opt,
 +                                        const Lex_ident_sys_st &name)
 +{
 +  check_opt.init();
 +  if (add_create_options_with_check(opt))
 +    return true;
 +  sql_command= SQLCOM_UNINSTALL_PLUGIN;
 +  comment= name;
 +  ident= null_clex_str;
 +  return false;
 +}
 +
 +
 +bool LEX::stmt_uninstall_plugin_by_soname(const DDL_options_st &opt,
 +                                          const LEX_CSTRING &soname)
 +{
 +  check_opt.init();
 +  if (add_create_options_with_check(opt))
 +    return true;
 +  sql_command= SQLCOM_UNINSTALL_PLUGIN;
 +  comment= null_clex_str;
 +  ident= soname;
 +  return false;
 +}
 +
 +
 +bool LEX::stmt_prepare_validate(const char *stmt_type)
 +{
 +  if (unlikely(table_or_sp_used()))
 +  {
 +    my_error(ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), stmt_type);
 +    return true;
 +  }
 +  return check_main_unit_semantics();
 +}
 +
 +
 +bool LEX::stmt_prepare(const Lex_ident_sys_st &ident, Item *code)
 +{
 +  sql_command= SQLCOM_PREPARE;
 +  if (stmt_prepare_validate("PREPARE..FROM"))
 +    return true;
 +  prepared_stmt.set(ident, code, NULL);
 +  return false;
 +}
 +
 +
 +bool LEX::stmt_execute_immediate(Item *code, List<Item> *params)
 +{
 +  sql_command= SQLCOM_EXECUTE_IMMEDIATE;
 +  if (stmt_prepare_validate("EXECUTE IMMEDIATE"))
 +    return true;
 +  static const Lex_ident_sys immediate(STRING_WITH_LEN("IMMEDIATE"));
 +  prepared_stmt.set(immediate, code, params);
 +  return false;
 +}
 +
 +
 +bool LEX::stmt_execute(const Lex_ident_sys_st &ident, List<Item> *params)
 +{
 +  sql_command= SQLCOM_EXECUTE;
 +  prepared_stmt.set(ident, NULL, params);
 +  return stmt_prepare_validate("EXECUTE..USING");
 +}
 +
 +
 +void LEX::stmt_deallocate_prepare(const Lex_ident_sys_st &ident)
 +{
 +  sql_command= SQLCOM_DEALLOCATE_PREPARE;
 +  prepared_stmt.set(ident, NULL, NULL);
 +}
 +
 +
 +bool LEX::stmt_alter_table_exchange_partition(Table_ident *table)
 +{
 +  DBUG_ASSERT(sql_command == SQLCOM_ALTER_TABLE);
 +  first_select_lex()->db= table->db;
 +  if (first_select_lex()->db.str == NULL &&
 +      copy_db_to(&first_select_lex()->db))
 +    return true;
 +  name= table->table;
 +  alter_info.partition_flags|= ALTER_PARTITION_EXCHANGE;
 +  if (!first_select_lex()->add_table_to_list(thd, table, NULL,
 +                                             TL_OPTION_UPDATING,
 +                                             TL_READ_NO_INSERT,
 +                                             MDL_SHARED_NO_WRITE))
 +    return true;
 +  DBUG_ASSERT(!m_sql_cmd);
 +  m_sql_cmd= new (thd->mem_root) Sql_cmd_alter_table_exchange_partition();
 +  return m_sql_cmd == NULL;
 +}
 +
 +
 +void LEX::stmt_purge_to(const LEX_CSTRING &to)
 +{
 +  type= 0;
 +  sql_command= SQLCOM_PURGE;
 +  to_log= to.str;
 +}
 +
 +
 +bool LEX::stmt_purge_before(Item *item)
 +{
 +  type= 0;
 +  sql_command= SQLCOM_PURGE_BEFORE;
 +  value_list.empty();
 +  value_list.push_front(item, thd->mem_root);
 +  return check_main_unit_semantics();
 +}
 +
 +
 +bool LEX::stmt_create_udf_function(const DDL_options_st &options,
 +                                   enum_sp_aggregate_type agg_type,
 +                                   const Lex_ident_sys_st &name,
 +                                   Item_result return_type,
 +                                   const LEX_CSTRING &soname)
 +{
 +  if (stmt_create_function_start(options))
 +    return true;
 +
 +   if (unlikely(is_native_function(thd, &name)))
 +   {
 +     my_error(ER_NATIVE_FCT_NAME_COLLISION, MYF(0), name.str);
 +     return true;
 +   }
 +   sql_command= SQLCOM_CREATE_FUNCTION;
 +   udf.name= name;
 +   udf.returns= return_type;
 +   udf.dl= soname.str;
 +   udf.type= agg_type == GROUP_AGGREGATE ? UDFTYPE_AGGREGATE :
 +                                           UDFTYPE_FUNCTION;
 +   stmt_create_routine_finalize();
 +   return false;
 +}
 +
 +
 +bool LEX::stmt_create_stored_function_start(const DDL_options_st &options,
 +                                            enum_sp_aggregate_type agg_type,
 +                                            const sp_name *spname)
 +{
 +  if (stmt_create_function_start(options) ||
 +      unlikely(!make_sp_head_no_recursive(thd, spname,
 +                                          &sp_handler_function, agg_type)))
 +    return true;
 +  return false;
 +}
diff --cc sql/sql_lex.h
index 58c1dd3dfae,78a96305e3b..76e8b86d12d
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@@ -1347,7 -1229,13 +1353,7 @@@ public
    TABLE_LIST *convert_right_join();
    List<Item>* get_item_list();
    ulong get_table_join_options();
-   void set_lock_for_tables(thr_lock_type lock_type);
+   void set_lock_for_tables(thr_lock_type lock_type, bool for_update);
 -  inline void init_order()
 -  {
 -    order_list.elements= 0;
 -    order_list.first= 0;
 -    order_list.next= &order_list.first;
 -  }
    /*
      This method created for reiniting LEX in mysql_admin_table() and can be
      used only if you are going remove all SELECT_LEX & units except belonger
diff --cc sql/sql_select.cc
index 823e3ed88bf,f36a68bc7ae..fac0b03cbbc
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@@ -1315,8 -1219,9 +1315,9 @@@ JOIN::prepare(TABLE_LIST *tables_init
              item->max_length)))
          real_order= TRUE;
  
-       if (item->with_sum_func() && item->type() != Item::SUM_FUNC_ITEM)
-         item->split_sum_func(thd, ref_ptrs, all_fields, 0);
 -      if ((item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM) ||
++      if ((item->with_sum_func() && item->type() != Item::SUM_FUNC_ITEM) ||
+           item->with_window_func)
+         item->split_sum_func(thd, ref_ptrs, all_fields, SPLIT_SUM_SELECT);
      }
      if (!real_order)
        order= NULL;
@@@ -17404,22 -16743,6 +17405,26 @@@ Field *Item::create_tmp_field_int(TABL
                                        *this, table);
  }
  
 +Field *Item::tmp_table_field_from_field_type_maybe_null(TABLE *table,
 +                                            Tmp_field_src *src,
 +                                            const Tmp_field_param *param,
 +                                            bool is_explicit_null)
 +{
-   DBUG_ASSERT(!param->make_copy_field());
++  /*
++    item->type() == CONST_ITEM excluded due to making fields for counter
++    With help of Item_uint
++  */
++  DBUG_ASSERT(!param->make_copy_field() || type() == CONST_ITEM);
 +  DBUG_ASSERT(!is_result_field());
 +  Field *result;
 +  if ((result= tmp_table_field_from_field_type(table)))
 +  {
 +    if (result && is_explicit_null)
 +      result->is_created_from_null_item= true;
 +  }
 +  return result;
 +}
 +
  
  Field *Item_sum::create_tmp_field(bool group, TABLE *table)
  {
@@@ -23859,6 -23216,10 +23864,10 @@@ int setup_order(THD *thd, Ref_ptr_arra
        my_error(ER_WINDOW_FUNCTION_IN_WINDOW_SPEC, MYF(0));
        return 1;
      }
 -    if (from_window_spec && (*order->item)->with_sum_func &&
++    if (from_window_spec && (*order->item)->with_sum_func() &&
+         (*order->item)->type() != Item::SUM_FUNC_ITEM)
+       (*order->item)->split_sum_func(thd, ref_pointer_array,
+                                      all_fields, SPLIT_SUM_SELECT);
    }
    return 0;
  }
@@@ -23926,6 -23287,10 +23935,10 @@@ setup_group(THD *thd, Ref_ptr_array ref
          my_error(ER_WINDOW_FUNCTION_IN_WINDOW_SPEC, MYF(0));
        return 1;
      }
 -    if (from_window_spec && (*ord->item)->with_sum_func &&
++    if (from_window_spec && (*ord->item)->with_sum_func() &&
+         (*ord->item)->type() != Item::SUM_FUNC_ITEM)
+       (*ord->item)->split_sum_func(thd, ref_pointer_array,
+                                    all_fields, SPLIT_SUM_SELECT);
    }
    if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY &&
        context_analysis_place == IN_GROUP_BY)
diff --cc sql/sql_string.cc
index 45af08f8966,0cc653c29a9..410f52a8c74
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@@ -941,7 -996,28 +941,28 @@@ String *copy_if_not_alloced(String *to,
      (void) from->realloc(from_length);
      return from;
    }
+   if (from->uses_buffer_owned_by(to))
+   {
 -    DBUG_ASSERT(!from->alloced);
 -    DBUG_ASSERT(to->alloced);
++    DBUG_ASSERT(!from->is_alloced());
++    DBUG_ASSERT(to->is_alloced());
+     /*
+       "from" is a constant string pointing to a fragment of alloced string "to":
+         to=  xxxFFFyyy
+       - FFF is the part of "to" pointed by "from"
+       - xxx is the part of "to" before "from"
+       - yyy is the part of "to" after "from"
+     */
+     uint32 xxx_length= (uint32) (from->ptr() - to->ptr());
+     uint32 yyy_length= (uint32) (to->end() - from->end());
+     DBUG_ASSERT(to->length() >= yyy_length);
+     to->length(to->length() - yyy_length); // Remove the "yyy" part
+     DBUG_ASSERT(to->length() >= xxx_length);
+     to->replace(0, xxx_length, "", 0);     // Remove the "xxx" part
+     to->realloc(from_length);
 -    to->str_charset= from->str_charset;
++    to->set_charset(from->charset());
+     return to;
+   }
 -  if (to->realloc(from_length))
 +  if (to->alloc(from_length))
      return from;				// Actually an error
    if ((to->str_length=MY_MIN(from->str_length,from_length)))
      memcpy(to->Ptr,from->Ptr,to->str_length);
diff --cc sql/sql_table.cc
index 28c67f0e59a,ad86cdf8514..df5dea0bfad
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@@ -10032,13 -9858,13 +10078,14 @@@ do_continue:
  
    /* Mark that we have created table in storage engine. */
    no_ha_table= false;
+   DEBUG_SYNC(thd, "alter_table_intermediate_table_created");
  
 -  new_table=
 -    thd->create_and_open_tmp_table(new_db_type, &frm, alter_ctx.get_tmp_path(),
 -                                   alter_ctx.new_db.str,
 -                                   alter_ctx.new_name.str,
 -                                   true, true);
 +  /* Open the table since we need to copy the data. */
 +  new_table= thd->create_and_open_tmp_table(&frm,
 +                                            alter_ctx.get_tmp_path(),
 +                                            alter_ctx.new_db.str,
 +                                            alter_ctx.new_name.str,
 +                                            true);
    if (!new_table)
      goto err_new_table_cleanup;
  
diff --cc sql/sql_tvc.cc
index f16d34e8041,c9b55fe210e..ef8e15df838
--- a/sql/sql_tvc.cc
+++ b/sql/sql_tvc.cc
@@@ -262,6 -263,35 +262,35 @@@ bool table_value_constr::prepare(THD *t
    if (result && result->prepare(sl->item_list, unit_arg))
      DBUG_RETURN(true);
  
+   /*
+     setup_order() for a TVC is not called when the following is true
+     (thd->lex->context_analysis_only & CONTEXT_ANALYSIS_ONLY_VIEW)
+   */
+ 
+   thd->where="order clause";
+   ORDER *order= sl->order_list.first;
+   for (; order; order=order->next)
+   {
+     Item *order_item= *order->item;
 -    if (order_item->type() == Item::INT_ITEM && order_item->basic_const_item())
++    if (order_item->is_order_clause_position())
+     {
+       uint count= 0;
+       if (order->counter_used)
+         count= order->counter; // counter was once resolved
+       else
+         count= (uint) order_item->val_int();
+       if (!count || count > first_elem->elements)
+       {
+         my_error(ER_BAD_FIELD_ERROR, MYF(0),
+                  order_item->full_name(), thd->where);
+         DBUG_RETURN(true);
+       }
+       order->in_field_list= 1;
+       order->counter= count;
+       order->counter_used= 1;
+     }
+   }
+ 
    select_lex->in_tvc= false;
    DBUG_RETURN(false);
  }
@@@ -561,11 -643,11 +642,11 @@@ st_select_lex *wrap_tvc(THD *thd, st_se
    mysql_init_select(lex);
    /* Create item list as '*' for the subquery SQ */
    Item *item;
-   SELECT_LEX *sq_select; // select for IN subquery;
-   sq_select= lex->current_select;
-   sq_select->set_linkage(tvc_sl->get_linkage());
-   sq_select->parsing_place= SELECT_LIST;
-   item= new (thd->mem_root) Item_field(thd, &sq_select->context,
+   SELECT_LEX *wrapper_sl;
+   wrapper_sl= lex->current_select;
 -  wrapper_sl->linkage= tvc_sl->linkage;
++  wrapper_sl->set_linkage(tvc_sl->get_linkage());
+   wrapper_sl->parsing_place= SELECT_LIST;
+   item= new (thd->mem_root) Item_field(thd, &wrapper_sl->context,
                                         NULL, NULL, &star_clex_str);
    if (item == NULL || add_item_to_list(thd, item))
      goto err;
@@@ -582,9 -664,9 +663,9 @@@
      goto err;
    tvc_select= lex->current_select;
    derived_unit= tvc_select->master_unit();
 -  tvc_select->linkage= DERIVED_TABLE_TYPE;
 +  tvc_select->set_linkage(DERIVED_TABLE_TYPE);
  
-   lex->current_select= sq_select;
+   lex->current_select= wrapper_sl;
  
    /*
      Create the name of the wrapping derived table and
diff --cc sql/sql_type.cc
index 5a6b7876a1c,d07296aad7e..fc33b6d1427
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@@ -134,20 -125,38 +134,46 @@@ bool Type_handler_data::init(
  Type_handler_data *type_handler_data= NULL;
  
  
+ bool Float::to_string(String *val_buffer, uint dec) const
+ {
+   uint to_length= 70;
+   if (val_buffer->alloc(to_length))
+     return true;
+ 
+   char *to=(char*) val_buffer->ptr();
+   size_t len;
+ 
+   if (dec >= FLOATING_POINT_DECIMALS)
+     len= my_gcvt(m_value, MY_GCVT_ARG_FLOAT, to_length - 1, to, NULL);
+   else
+   {
+     /*
+       We are safe here because the buffer length is 70, and
+       fabs(float) < 10^39, dec < FLOATING_POINT_DECIMALS. So the resulting string
+       will be not longer than 69 chars + terminating '\0'.
+     */
+     len= my_fcvt(m_value, (int) dec, to, NULL);
+   }
+   val_buffer->length((uint) len);
+   val_buffer->set_charset(&my_charset_numeric);
+   return false;
+ }
+ 
+ 
 -void Time::make_from_item(Item *item, const Options opt)
 +String_ptr::String_ptr(Item *item, String *buffer)
 + :m_string_ptr(item->val_str(buffer))
 +{ }
 +
 +
 +Ascii_ptr::Ascii_ptr(Item *item, String *buffer)
 + :String_ptr(item->val_str_ascii(buffer))
 +{ }
 +
 +
 +void VDec::set(Item *item)
  {
 -  if (item->get_date(this, opt.get_date_flags()))
 -    time_type= MYSQL_TIMESTAMP_NONE;
 -  else
 -    valid_MYSQL_TIME_to_valid_value(opt);
 +  m_ptr= item->val_decimal(&m_buffer);
 +  DBUG_ASSERT((m_ptr == NULL) == item->null_value);
  }
  
  
@@@ -3519,273 -1808,272 +3545,279 @@@ void Type_handler_decimal_result::Item_
  }
  
  
 -/*************************************************************************/
 -
 -bool Type_handler::
 -       Column_definition_prepare_stage2_legacy(Column_definition *def,
 -                                               enum_field_types type) const
 -{
 -  def->pack_flag= f_settype((uint) type);
 -  return false;
 -}
 -
 -bool Type_handler::
 -       Column_definition_prepare_stage2_legacy_num(Column_definition *def,
 -                                                   enum_field_types type) const
 +void Type_handler_int_result::Item_update_null_value(Item *item) const
  {
 -  def->pack_flag= def->pack_flag_numeric(def->decimals) |
 -                  f_settype((uint) type);
 -  return false;
 +  (void) item->val_int();
  }
  
 -bool Type_handler::
 -       Column_definition_prepare_stage2_legacy_real(Column_definition *def,
 -                                                    enum_field_types type) const
 -{
 -  uint dec= def->decimals;
 -  /*
 -    User specified FLOAT() or DOUBLE() without precision. Change to
 -    FLOATING_POINT_DECIMALS to keep things compatible with earlier MariaDB
 -    versions.
 -  */
 -  if (dec >= FLOATING_POINT_DECIMALS)
 -    dec= FLOATING_POINT_DECIMALS;
 -  def->pack_flag= def->pack_flag_numeric(dec) | f_settype((uint) type);
 -  return false;
 -}
  
 -bool Type_handler_newdecimal::
 -       Column_definition_prepare_stage2(Column_definition *def,
 -                                        handler *file,
 -                                        ulonglong table_flags) const
 +void Type_handler_bool::Item_update_null_value(Item *item) const
  {
 -  def->pack_flag= def->pack_flag_numeric(def->decimals);
 -  return false;
 +  (void) item->val_bool();
  }
  
 -bool Type_handler_blob_common::
 -       Column_definition_prepare_stage2(Column_definition *def,
 -                                        handler *file,
 -                                        ulonglong table_flags) const
 -{
 -  return def->prepare_stage2_blob(file, table_flags, FIELDFLAG_BLOB);
 -}
  
 -#ifdef HAVE_SPATIAL
 -bool Type_handler_geometry::
 -       Column_definition_prepare_stage2(Column_definition *def,
 -                                        handler *file,
 -                                        ulonglong table_flags) const
 -{
 -  if (!(table_flags & HA_CAN_GEOMETRY))
 -  {
 -    my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "GEOMETRY");
 -    return true;
 -  }
 -  return def->prepare_stage2_blob(file, table_flags, FIELDFLAG_GEOM);
 -}
 -#endif
 +/*************************************************************************/
  
 -bool Type_handler_varchar::
 -       Column_definition_prepare_stage2(Column_definition *def,
 -                                        handler *file,
 -                                        ulonglong table_flags) const
 +int Type_handler_time_common::Item_save_in_field(Item *item, Field *field,
 +                                                 bool no_conversions) const
  {
 -  return def->prepare_stage2_varchar(table_flags);
 +  return item->save_time_in_field(field, no_conversions);
  }
  
 -bool Type_handler_string::
 -       Column_definition_prepare_stage2(Column_definition *def,
 -                                        handler *file,
 -                                        ulonglong table_flags) const
 +int Type_handler_temporal_with_date::Item_save_in_field(Item *item,
 +                                                        Field *field,
 +                                                        bool no_conversions)
 +                                                        const
  {
 -  def->pack_flag= (def->charset->state & MY_CS_BINSORT) ? FIELDFLAG_BINARY : 0;
 -  return false;
 +  return item->save_date_in_field(field, no_conversions);
  }
  
 -bool Type_handler_enum::
 -       Column_definition_prepare_stage2(Column_definition *def,
 -                                        handler *file,
 -                                        ulonglong table_flags) const
 +
 +int Type_handler_timestamp_common::Item_save_in_field(Item *item,
 +                                                      Field *field,
 +                                                      bool no_conversions)
 +                                                      const
  {
 -  uint dummy;
 -  return def->prepare_stage2_typelib("ENUM", FIELDFLAG_INTERVAL, &dummy);
 +  Timestamp_or_zero_datetime_native_null tmp(field->table->in_use, item, true);
 +  if (tmp.is_null())
 +    return set_field_to_null_with_conversions(field, no_conversions);
 +  return tmp.save_in_field(field, item->decimals);
  }
  
 -bool Type_handler_set::
 -       Column_definition_prepare_stage2(Column_definition *def,
 -                                        handler *file,
 -                                        ulonglong table_flags) const
 +
 +int Type_handler_string_result::Item_save_in_field(Item *item, Field *field,
 +                                                   bool no_conversions) const
  {
 -  uint dup_count;
 -  if (def->prepare_stage2_typelib("SET", FIELDFLAG_BITFIELD, &dup_count))
 -    return true;
 -  /* Check that count of unique members is not more then 64 */
 -  if (def->interval->count - dup_count > sizeof(longlong)*8)
 -  {
 -     my_error(ER_TOO_BIG_SET, MYF(0), def->field_name.str);
 -     return true;
 -  }
 -  return false;
 +  return item->save_str_in_field(field, no_conversions);
  }
  
 -bool Type_handler_bit::
 -       Column_definition_prepare_stage2(Column_definition *def,
 -                                        handler *file,
 -                                        ulonglong table_flags) const
 +
 +int Type_handler_real_result::Item_save_in_field(Item *item, Field *field,
 +                                                 bool no_conversions) const
  {
 -  /* 
 -    We have sql_field->pack_flag already set here, see
 -    mysql_prepare_create_table().
 -  */
 -  return false;
 +  return item->save_real_in_field(field, no_conversions);
  }
  
 -/*************************************************************************/
  
 -uint32 Type_handler_time::calc_pack_length(uint32 length) const
 +int Type_handler_decimal_result::Item_save_in_field(Item *item, Field *field,
 +                                                    bool no_conversions) const
  {
 -  return length > MIN_TIME_WIDTH ?
 -         hires_bytes(length - 1 - MIN_TIME_WIDTH) : 3;
 +  return item->save_decimal_in_field(field, no_conversions);
  }
  
 -uint32 Type_handler_time2::calc_pack_length(uint32 length) const
 +
 +int Type_handler_int_result::Item_save_in_field(Item *item, Field *field,
 +                                                bool no_conversions) const
  {
 -  return length > MIN_TIME_WIDTH ?
 -         my_time_binary_length(length - MIN_TIME_WIDTH - 1) : 3;
 +  return item->save_int_in_field(field, no_conversions);
  }
  
 -uint32 Type_handler_timestamp::calc_pack_length(uint32 length) const
 +
 +/***********************************************************************/
 +
 +bool Type_handler_row::set_comparator_func(Arg_comparator *cmp) const
  {
 -  return length > MAX_DATETIME_WIDTH ?
 -         4 + sec_part_bytes(length - 1 - MAX_DATETIME_WIDTH) : 4;
 +  return cmp->set_cmp_func_row();
  }
  
 -uint32 Type_handler_timestamp2::calc_pack_length(uint32 length) const
 +bool Type_handler_int_result::set_comparator_func(Arg_comparator *cmp) const
  {
 -  return length > MAX_DATETIME_WIDTH ?
 -         my_timestamp_binary_length(length - MAX_DATETIME_WIDTH - 1) : 4;
 +  return cmp->set_cmp_func_int();
  }
  
 -uint32 Type_handler_datetime::calc_pack_length(uint32 length) const
 +bool Type_handler_real_result::set_comparator_func(Arg_comparator *cmp) const
  {
 -  return length > MAX_DATETIME_WIDTH ?
 -         hires_bytes(length - 1 - MAX_DATETIME_WIDTH) : 8;
 +  return cmp->set_cmp_func_real();
  }
  
 -uint32 Type_handler_datetime2::calc_pack_length(uint32 length) const
 +bool Type_handler_decimal_result::set_comparator_func(Arg_comparator *cmp) const
  {
 -  return length > MAX_DATETIME_WIDTH ?
 -         my_datetime_binary_length(length - MAX_DATETIME_WIDTH - 1) : 5;
 +  return cmp->set_cmp_func_decimal();
  }
  
 -uint32 Type_handler_tiny_blob::calc_pack_length(uint32 length) const
 +bool Type_handler_string_result::set_comparator_func(Arg_comparator *cmp) const
  {
 -  return 1 + portable_sizeof_char_ptr;
 +  return cmp->set_cmp_func_string();
  }
  
 -uint32 Type_handler_blob::calc_pack_length(uint32 length) const
 +bool Type_handler_time_common::set_comparator_func(Arg_comparator *cmp) const
  {
 -  return 2 + portable_sizeof_char_ptr;
 +  return cmp->set_cmp_func_time();
  }
  
 -uint32 Type_handler_medium_blob::calc_pack_length(uint32 length) const
 +bool
 +Type_handler_temporal_with_date::set_comparator_func(Arg_comparator *cmp) const
  {
 -  return 3 + portable_sizeof_char_ptr;
 +  return cmp->set_cmp_func_datetime();
  }
  
 -uint32 Type_handler_long_blob::calc_pack_length(uint32 length) const
 +bool
 +Type_handler_timestamp_common::set_comparator_func(Arg_comparator *cmp) const
  {
 -  return 4 + portable_sizeof_char_ptr;
 +  return cmp->set_cmp_func_native();
  }
  
 -#ifdef HAVE_SPATIAL
 -uint32 Type_handler_geometry::calc_pack_length(uint32 length) const
 +
 +/*************************************************************************/
 +
 +bool Type_handler_temporal_result::
 +       can_change_cond_ref_to_const(Item_bool_func2 *target,
 +                                    Item *target_expr, Item *target_value,
 +                                    Item_bool_func2 *source,
 +                                    Item *source_expr, Item *source_const)
 +                                    const
  {
 -  return 4 + portable_sizeof_char_ptr;
 +  if (source->compare_type_handler()->cmp_type() != TIME_RESULT)
 +    return false;
 +
 +  /*
 +    Can't rewrite:
 +      WHERE COALESCE(time_column)='00:00:00'
 +        AND COALESCE(time_column)=DATE'2015-09-11'
 +    to
 +      WHERE DATE'2015-09-11'='00:00:00'
 +        AND COALESCE(time_column)=DATE'2015-09-11'
 +    because the left part will erroneously try to parse '00:00:00'
 +    as DATE, not as TIME.
 +
 +    TODO: It could still be rewritten to:
 +      WHERE DATE'2015-09-11'=TIME'00:00:00'
 +        AND COALESCE(time_column)=DATE'2015-09-11'
 +    i.e. we need to replace both target_expr and target_value
 +    at the same time. This is not supported yet.
 +  */
 +  return target_value->cmp_type() == TIME_RESULT;
  }
 -#endif
  
 -uint32 Type_handler_newdecimal::calc_pack_length(uint32 length) const
 +
 +bool Type_handler_string_result::
 +       can_change_cond_ref_to_const(Item_bool_func2 *target,
 +                                    Item *target_expr, Item *target_value,
 +                                    Item_bool_func2 *source,
 +                                    Item *source_expr, Item *source_const)
 +                                    const
  {
 -  abort();  // This shouldn't happen
 -  return 0;
 +  if (source->compare_type_handler()->cmp_type() != STRING_RESULT)
 +    return false;
 +  /*
 +    In this example:
 +      SET NAMES utf8 COLLATE utf8_german2_ci;
 +      DROP TABLE IF EXISTS t1;
 +      CREATE TABLE t1 (a CHAR(10) CHARACTER SET utf8);
 +      INSERT INTO t1 VALUES ('o-umlaut'),('oe');
 +      SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe';
 +
 +    the query should return only the row with 'oe'.
 +    It should not return 'o-umlaut', because 'o-umlaut' does not match
 +    the right part of the condition: a='oe'
 +    ('o-umlaut' is not equal to 'oe' in utf8_general_ci,
 +     which is the collation of the field "a").
 +
 +    If we change the right part from:
 +       ... AND a='oe'
 +    to
 +       ... AND 'oe' COLLATE utf8_german2_ci='oe'
 +    it will be evalulated to TRUE and removed from the condition,
 +    so the overall query will be simplified to:
 +
 +      SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci;
 +
 +    which will erroneously start to return both 'oe' and 'o-umlaut'.
 +    So changing "expr" to "const" is not possible if the effective
 +    collations of "target" and "source" are not exactly the same.
 +
 +    Note, the code before the fix for MDEV-7152 only checked that
 +    collations of "source_const" and "target_value" are the same.
 +    This was not enough, as the bug report demonstrated.
 +  */
 +  return
 +    target->compare_collation() == source->compare_collation() &&
 +    target_value->collation.collation == source_const->collation.collation;
  }
  
 -uint32 Type_handler_set::calc_pack_length(uint32 length) const
 +
 +bool Type_handler_numeric::
 +       can_change_cond_ref_to_const(Item_bool_func2 *target,
 +                                    Item *target_expr, Item *target_value,
 +                                    Item_bool_func2 *source,
 +                                    Item *source_expr, Item *source_const)
 +                                    const
  {
 -  abort();  // This shouldn't happen
 -  return 0;
 +  /*
 +   The collations of "target" and "source" do not make sense for numeric
 +   data types.
 +  */
 +  return target->compare_type_handler() == source->compare_type_handler();
  }
  
 -uint32 Type_handler_enum::calc_pack_length(uint32 length) const
 +
 +/*************************************************************************/
 +
 +Item_cache *
 +Type_handler_row::Item_get_cache(THD *thd, const Item *item) const
  {
 -  abort();  // This shouldn't happen
 -  return 0;
 +  return new (thd->mem_root) Item_cache_row(thd);
  }
  
 +Item_cache *
 +Type_handler_int_result::Item_get_cache(THD *thd, const Item *item) const
 +{
 +  return new (thd->mem_root) Item_cache_int(thd, item->type_handler());
 +}
  
 -/*************************************************************************/
 -Field *Type_handler::make_and_init_table_field(const LEX_CSTRING *name,
 -                                               const Record_addr &addr,
 -                                               const Type_all_attributes &attr,
 -                                               TABLE *table) const
 +Item_cache *
 +Type_handler_year::Item_get_cache(THD *thd, const Item *item) const
  {
 -  Field *field= make_table_field(name, addr, attr, table);
 -  if (field)
 -    field->init(table);
 -  return field;
 +  return new (thd->mem_root) Item_cache_year(thd, item->type_handler());
  }
  
 +Item_cache *
- Type_handler_real_result::Item_get_cache(THD *thd, const Item *item) const
++Type_handler_double::Item_get_cache(THD *thd, const Item *item) const
 +{
-   return new (thd->mem_root) Item_cache_real(thd);
++  return new (thd->mem_root) Item_cache_double(thd);
++}
+ 
 -Field *Type_handler_tiny::make_table_field(const LEX_CSTRING *name,
 -                                           const Record_addr &addr,
 -                                           const Type_all_attributes &attr,
 -                                           TABLE *table) const
++Item_cache *
++Type_handler_float::Item_get_cache(THD *thd, const Item *item) const
+ {
 -  return new (table->in_use->mem_root)
 -         Field_tiny(addr.ptr, attr.max_char_length(),
 -                    addr.null_ptr, addr.null_bit,
 -                    Field::NONE, name, 0/*zerofill*/, attr.unsigned_flag);
++  return new (thd->mem_root) Item_cache_float(thd);
  }
  
 +Item_cache *
 +Type_handler_decimal_result::Item_get_cache(THD *thd, const Item *item) const
 +{
 +  return new (thd->mem_root) Item_cache_decimal(thd);
 +}
  
 -Field *Type_handler_short::make_table_field(const LEX_CSTRING *name,
 -                                           const Record_addr &addr,
 -                                           const Type_all_attributes &attr,
 -                                           TABLE *table) const
 +Item_cache *
 +Type_handler_string_result::Item_get_cache(THD *thd, const Item *item) const
 +{
 +  return new (thd->mem_root) Item_cache_str(thd, item);
 +}
  
 +Item_cache *
 +Type_handler_timestamp_common::Item_get_cache(THD *thd, const Item *item) const
  {
 -  return new (table->in_use->mem_root)
 -         Field_short(addr.ptr, attr.max_char_length(),
 -                     addr.null_ptr, addr.null_bit,
 -                     Field::NONE, name, 0/*zerofill*/, attr.unsigned_flag);
 +  return new (thd->mem_root) Item_cache_timestamp(thd);
  }
  
 -
 -Field *Type_handler_int24::make_table_field(const LEX_CSTRING *name,
 -                                            const Record_addr &addr,
 -                                            const Type_all_attributes &attr,
 -                                            TABLE *table) const
 +Item_cache *
 +Type_handler_datetime_common::Item_get_cache(THD *thd, const Item *item) const
  {
 -  return new (table->in_use->mem_root)
 -         Field_medium(addr.ptr, attr.max_char_length(),
 -                      addr.null_ptr, addr.null_bit,
 -                      Field::NONE, name,
 -                      0/*zerofill*/, attr.unsigned_flag);
 +  return new (thd->mem_root) Item_cache_datetime(thd);
  }
  
 +Item_cache *
 +Type_handler_time_common::Item_get_cache(THD *thd, const Item *item) const
 +{
 +  return new (thd->mem_root) Item_cache_time(thd);
 +}
  
 -Field *Type_handler_long::make_table_field(const LEX_CSTRING *name,
 -                                           const Record_addr &addr,
 -                                           const Type_all_attributes &attr,
 -                                           TABLE *table) const
 +Item_cache *
 +Type_handler_date_common::Item_get_cache(THD *thd, const Item *item) const
  {
 -  return new (table->in_use->mem_root)
 -         Field_long(addr.ptr, attr.max_char_length(),
 -                    addr.null_ptr, addr.null_bit,
 -                    Field::NONE, name, 0/*zerofill*/, attr.unsigned_flag);
 +  return new (thd->mem_root) Item_cache_date(thd);
  }
  
  
@@@ -4706,53 -2915,144 +4738,64 @@@ Type_handler_int_result::Item_func_hybr
  }
  
  
 -bool Type_handler_timestamp_common::
 -       Item_hybrid_func_fix_attributes(THD *thd,
 -                                       const char *func_name,
 -                                       Type_handler_hybrid_field_type *handler,
 -                                       Type_all_attributes *func,
 -                                       Item **items, uint nitems) const
 +my_decimal *
 +Type_handler_int_result::Item_func_hybrid_field_type_val_decimal(
 +                                          Item_func_hybrid_field_type *item,
 +                                          my_decimal *dec) const
  {
 -  func->aggregate_attributes_temporal(MAX_DATETIME_WIDTH, items, nitems);
 -  return false;
 +  return item->val_decimal_from_int_op(dec);
  }
  
 -#ifdef HAVE_SPATIAL
 -bool Type_handler_geometry::
 -       Item_hybrid_func_fix_attributes(THD *thd,
 -                                       const char *func_name,
 -                                       Type_handler_hybrid_field_type *handler,
 -                                       Type_all_attributes *func,
 -                                       Item **items, uint nitems) const
 +
 +void
 +Type_handler_int_result::Item_func_hybrid_field_type_get_date(
 +                                          THD *thd,
 +                                          Item_func_hybrid_field_type *item,
 +                                          Temporal::Warn *warn,
 +                                          MYSQL_TIME *to,
 +                                          date_mode_t mode) const
  {
 -  DBUG_ASSERT(nitems > 0);
 -  Type_geometry_attributes gattr(items[0]->type_handler(), items[0]);
 -  for (uint i= 1; i < nitems; i++)
 -    gattr.join(items[i]);
 -  func->set_geometry_type(gattr.get_geometry_type());
 -  func->collation.set(&my_charset_bin);
 -  func->unsigned_flag= false;
 -  func->decimals= 0;
 -  func->max_length= (uint32) UINT_MAX32;
 -  func->set_maybe_null(true);
 -  return false;
 +  new(to) Temporal_hybrid(thd, warn, item->to_longlong_hybrid_null_op(), mode);
  }
 -#endif
  
  
 -/*************************************************************************/
 +/***************************************************************************/
  
 -bool Type_handler::
 -       Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func,
 -                                        Item **items, uint nitems) const
 +String *
- Type_handler_real_result::Item_func_hybrid_field_type_val_str(
++Type_handler_double::Item_func_hybrid_field_type_val_str(
 +                                           Item_func_hybrid_field_type *item,
 +                                           String *str) const
  {
 -  /*
 -    Aggregating attributes for LEAST/GREATES is exactly the same
 -    with aggregating for CASE-alike functions (e.g. COALESCE)
 -    for the majority of data type handlers.
 -  */
 -  return Item_hybrid_func_fix_attributes(thd, func->func_name(),
 -                                         func, func, items, nitems);
 +  return item->val_str_from_real_op(str);
  }
  
 -
 -bool Type_handler_temporal_result::
 -       Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func,
 -                                        Item **items, uint nitems) const
++String *
++Type_handler_float::Item_func_hybrid_field_type_val_str(
++                                           Item_func_hybrid_field_type *item,
++                                           String *str) const
+ {
 -  bool rc= Type_handler::Item_func_min_max_fix_attributes(thd, func,
 -                                                          items, nitems);
 -  if (rc || func->maybe_null)
 -    return rc;
 -  /*
 -    LEAST/GREATES(non-temporal, temporal) can return NULL.
 -    CAST functions Item_{time|datetime|date}_typecast always set maybe_full
 -    to true. Here we try to detect nullability more thoroughly.
 -    Perhaps CAST functions should also reuse this idea eventually.
 -  */
 -  const Type_handler *hf= func->type_handler();
 -  for (uint i= 0; i < nitems; i++)
 -  {
 -    /*
 -      If items[i] does not need conversion to the current temporal data
 -      type, then we trust items[i]->maybe_null, which was already ORred
 -      to func->maybe_null in the argument loop in fix_fields().
 -      If items[i] requires conversion to the current temporal data type,
 -      then conversion can fail and return NULL even for NOT NULL items.
 -    */
 -    const Type_handler *ha= items[i]->type_handler();
 -    if (hf == ha)
 -      continue; // No conversion.
 -    if (ha->cmp_type() != TIME_RESULT)
 -    {
 -      func->maybe_null= true; // Conversion from non-temporal is not safe
 -      break;
 -    }
 -    timestamp_type tf= hf->mysql_timestamp_type();
 -    timestamp_type ta= ha->mysql_timestamp_type();
 -    if (tf == ta ||
 -        (tf == MYSQL_TIMESTAMP_DATETIME && ta == MYSQL_TIMESTAMP_DATE))
 -    {
 -      /*
 -        If handlers have the same mysql_timestamp_type(),
 -        then conversion is NULL safe. Conversion from DATE to DATETIME
 -        is also safe. This branch includes data type pairs:
 -        Function return type Argument type  Comment
 -        -------------------- -------------  -------------
 -        TIMESTAMP            TIMESTAMP      no conversion
 -        TIMESTAMP            DATETIME       not possible
 -        TIMESTAMP            DATE           not possible
 -        DATETIME             DATETIME       no conversion
 -        DATETIME             TIMESTAMP      safe conversion
 -        DATETIME             DATE           safe conversion
 -        DATE                 DATE           no conversion
 -        TIME                 TIME           no conversion
++  Float nr(item->real_op());
++  if (item->null_value)
++    return 0;
++  nr.to_string(str, item->decimals);
++  return str;
++}
  
 -        Note, a function cannot return TIMESTAMP if it has non-TIMESTAMP
 -        arguments (it would return DATETIME in such case).
 -      */
 -      DBUG_ASSERT(hf->field_type() != MYSQL_TYPE_TIMESTAMP || tf == ta);
 -      continue;
 -    }
 -    /*
 -      Here we have the following data type pairs that did not match
 -      the condition above:
 +double
 +Type_handler_real_result::Item_func_hybrid_field_type_val_real(
 +                                           Item_func_hybrid_field_type *item)
 +                                           const
 +{
 +  return item->val_real_from_real_op();
 +}
  
 -      Function return type Argument type Comment
 -      -------------------- ------------- -------
 -      TIMESTAMP            TIME          Not possible
 -      DATETIME             TIME          depends on OLD_MODE_ZERO_DATE_TIME_CAST
 -      DATE                 TIMESTAMP     Not possible
 -      DATE                 DATETIME      Not possible
 -      DATE                 TIME          Not possible
 -      TIME                 TIMESTAMP     Not possible
 -      TIME                 DATETIME      Not possible
 -      TIME                 DATE          Not possible
  
 -      Most pairs are not possible, because the function data type
 -      would be DATETIME (according to LEAST/GREATEST aggregation rules).
 -      Conversion to DATETIME from TIME is not safe when
 -      OLD_MODE_ZERO_DATE_TIME_CAST is set:
 -      - negative TIME values cannot be converted to not-NULL DATETIME values
 -      - TIME values can produce DATETIME values that do not pass
 -        NO_ZERO_DATE and NO_ZERO_IN_DATE tests.
 -    */
 -    DBUG_ASSERT(hf->field_type() == MYSQL_TYPE_DATETIME);
 -    if (!(thd->variables.old_behavior & OLD_MODE_ZERO_DATE_TIME_CAST))
 -      continue;
 -    func->maybe_null= true;
 -    break;
 -  }
 -  return rc;
 +longlong
 +Type_handler_real_result::Item_func_hybrid_field_type_val_int(
 +                                           Item_func_hybrid_field_type *item)
 +                                           const
 +{
 +  return item->val_int_from_real_op();
  }
  
  
@@@ -5260,24 -3535,34 +5303,35 @@@ String *Type_handler_decimal_result:
  }
  
  
- String *Type_handler_real_result::
 -my_decimal *
 -Type_handler_decimal_result::Item_func_hybrid_field_type_val_decimal(
 -                                              Item_func_hybrid_field_type *item,
 -                                              my_decimal *dec) const
++String *Type_handler_double::
 +          Item_func_min_max_val_str(Item_func_min_max *func, String *str) const
  {
 -  return item->val_decimal_from_decimal_op(dec);
 +  return func->val_string_from_real(str);
  }
  
  
 -bool
 -Type_handler_decimal_result::Item_func_hybrid_field_type_get_date(
 -                                             Item_func_hybrid_field_type *item,
 -                                             MYSQL_TIME *ltime,
 -                                             ulonglong fuzzydate) const
++String *Type_handler_float::
++          Item_func_min_max_val_str(Item_func_min_max *func, String *str) const
+ {
 -  return item->get_date_from_decimal_op(ltime, fuzzydate);
++  Float nr(func->val_real());
++  if (func->null_value)
++    return 0;
++  nr.to_string(str, func->decimals);
++  return str;
+ }
+ 
+ 
 -/***************************************************************************/
 +double Type_handler_string_result::
 +         Item_func_min_max_val_real(Item_func_min_max *func) const
 +{
 +  return func->val_real_native();
 +}
  
  
 -String *
 -Type_handler_int_result::Item_func_hybrid_field_type_val_str(
 -                                          Item_func_hybrid_field_type *item,
 -                                          String *str) const
 +double Type_handler_time_common::
 +         Item_func_min_max_val_real(Item_func_min_max *func) const
  {
 -  return item->val_str_from_int_op(str);
 +  return Time(current_thd, func).to_double();
  }
  
  
@@@ -5888,11 -4105,20 +5942,19 @@@ bool Type_handler:
  }
  
  
 -double Type_handler_string_result::
 -         Item_func_min_max_val_real(Item_func_min_max *func) const
++bool Type_handler::
++       Item_float_typecast_fix_length_and_dec(Item_float_typecast *item) const
+ {
 -  return func->val_real_native();
++  item->fix_length_and_dec_generic();
++  return false;
+ }
+ 
+ 
 -double Type_handler_temporal_result::
 -         Item_func_min_max_val_real(Item_func_min_max *func) const
 +bool Type_handler::
 +       Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *item) const
  {
 -  MYSQL_TIME ltime;
 -  if (func->get_date(&ltime, 0))
 -    return 0;
 -  return TIME_to_double(&ltime);
 +  item->fix_length_and_dec_generic();
 +  return false;
  }
  
  
@@@ -5977,20 -4202,45 +6039,27 @@@ bool Type_handler_geometry:
  }
  
  
 -bool Type_handler_temporal_result::
 -       Item_func_min_max_get_date(Item_func_min_max *func,
 -                                  MYSQL_TIME *ltime, ulonglong fuzzydate) const
++bool Type_handler_geometry::
++       Item_float_typecast_fix_length_and_dec(Item_float_typecast *item) const
+ {
 -  return func->get_date_native(ltime, fuzzydate);
++  return Item_func_or_sum_illegal_param(item);
+ }
+ 
 -bool Type_handler_time_common::
 -       Item_func_min_max_get_date(Item_func_min_max *func,
 -                                  MYSQL_TIME *ltime, ulonglong fuzzydate) const
++
 +bool Type_handler_geometry::
 +       Item_decimal_typecast_fix_length_and_dec(Item_decimal_typecast *item) const
  {
 -  return func->get_time_native(ltime);
 +  return Item_func_or_sum_illegal_param(item);
  }
  
 -/***************************************************************************/
  
 -/**
 -  Get a string representation of the Item value.
 -  See sql_type.h for details.
 -*/
 -String *Type_handler_row::
 -          print_item_value(THD *thd, Item *item, String *str) const
 +bool Type_handler_geometry::
 +       Item_char_typecast_fix_length_and_dec(Item_char_typecast *item) const
  {
 -  CHARSET_INFO *cs= thd->variables.character_set_client;
 -  StringBuffer<STRING_BUFFER_USUAL_SIZE> val(cs);
 -  str->append(STRING_WITH_LEN("ROW("));
 -  for (uint i= 0 ; i < item->cols(); i++)
 -  {
 -    if (i > 0)
 -      str->append(',');
 -    Item *elem= item->element_index(i);
 -    String *tmp= elem->type_handler()->print_item_value(thd, elem, &val);
 -    if (tmp)
 -      str->append(*tmp);
 -    else
 -      str->append(STRING_WITH_LEN("NULL"));
 -  }
 -  str->append(STRING_WITH_LEN(")"));
 -  return str;
 +  if (item->cast_charset() != &my_charset_bin)
 +    return Item_func_or_sum_illegal_param(item); // CAST(geom AS CHAR)
 +  item->fix_length_and_dec_str();
 +  return false; // CAST(geom AS BINARY)
  }
  
  
@@@ -7006,59 -5047,52 +7075,68 @@@ Item *Type_handler_decimal_result:
  }
  
  
 -uint Type_handler_string_result::Item_temporal_precision(Item *item,
 -                                                         bool is_time) const
 +Item *Type_handler_double::
 +        create_typecast_item(THD *thd, Item *item,
 +                             const Type_cast_attributes &attr) const
  {
 -  MYSQL_TIME ltime;
 -  StringBuffer<64> buf;
 -  String *tmp;
 -  MYSQL_TIME_STATUS status;
 -  DBUG_ASSERT(item->fixed);
 -  if ((tmp= item->val_str(&buf)) &&
 -      !(is_time ?
 -        str_to_time(tmp->charset(), tmp->ptr(), tmp->length(),
 -                    &ltime, TIME_TIME_ONLY, &status) :
 -        str_to_datetime(tmp->charset(), tmp->ptr(), tmp->length(),
 -                        &ltime, TIME_FUZZY_DATES, &status)))
 -    return MY_MIN(status.precision, TIME_SECOND_PART_DIGITS);
 -  return MY_MIN(item->decimals, TIME_SECOND_PART_DIGITS);
 +  uint len, dec;
 +  if (!attr.length_specified())
 +    return new (thd->mem_root) Item_double_typecast(thd, item,
 +                                                    DBL_DIG + 7,
 +                                                    NOT_FIXED_DEC);
 +
 +  if (get_length_and_scale(attr.length(), attr.decimals(), &len, &dec,
 +                           DECIMAL_MAX_PRECISION, NOT_FIXED_DEC - 1, item))
 +    return NULL;
 +  return new (thd->mem_root) Item_double_typecast(thd, item, len, dec);
  }
  
 -/***************************************************************************/
  
 -uint Type_handler::Item_decimal_scale(const Item *item) const
++Item *Type_handler_float::
++        create_typecast_item(THD *thd, Item *item,
++                             const Type_cast_attributes &attr) const
+ {
 -  return item->decimals < NOT_FIXED_DEC ?
 -         item->decimals :
 -         MY_MIN(item->max_length, DECIMAL_MAX_SCALE);
++  DBUG_ASSERT(!attr.length_specified());
++  return new (thd->mem_root) Item_float_typecast(thd, item);
+ }
+ 
 -uint Type_handler_temporal_result::
 -       Item_decimal_scale_with_seconds(const Item *item) const
 -{
 -  return item->decimals < NOT_FIXED_DEC ?
 -         item->decimals :
 -         TIME_SECOND_PART_DIGITS;
 -}
+ 
 -uint Type_handler::Item_divisor_precision_increment(const Item *item) const
 +Item *Type_handler_long_blob::
 +        create_typecast_item(THD *thd, Item *item,
 +                             const Type_cast_attributes &attr) const
  {
 -  return item->decimals;
 +  int len= -1;
 +  CHARSET_INFO *real_cs= attr.charset() ?
 +                         attr.charset() :
 +                         thd->variables.collation_connection;
 +  if (attr.length_specified())
 +  {
 +    if (attr.length() > MAX_FIELD_BLOBLENGTH)
 +    {
 +      char buff[1024];
 +      String buf(buff, sizeof(buff), system_charset_info);
 +      my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), item_name(item, &buf),
 +               MAX_FIELD_BLOBLENGTH);
 +      return NULL;
 +    }
 +    len= (int) attr.length();
 +  }
 +  return new (thd->mem_root) Item_char_typecast(thd, item, len, real_cs);
  }
  
 -uint Type_handler_temporal_result::
 -       Item_divisor_precision_increment_with_seconds(const Item *item) const
 +Item *Type_handler_interval_DDhhmmssff::
 +        create_typecast_item(THD *thd, Item *item,
 +                             const Type_cast_attributes &attr) const
  {
 -  return item->decimals <  NOT_FIXED_DEC ?
 -         item->decimals :
 -         TIME_SECOND_PART_DIGITS;
 +  if (attr.decimals() > MAX_DATETIME_PRECISION)
 +  {
 +    wrong_precision_error(ER_TOO_BIG_PRECISION, item, attr.decimals(),
 +                          MAX_DATETIME_PRECISION);
 +    return 0;
 +  }
 +  return new (thd->mem_root) Item_interval_DDhhmmssff_typecast(thd, item,
 +                                                               (uint)
 +                                                               attr.decimals());
  }
  
  /***************************************************************************/
diff --cc sql/sql_type.h
index 5e6d1ec47f6,ef1a44a420c..6d9d802913f
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@@ -25,7 -25,7 +25,8 @@@
  #include "sql_array.h"
  #include "sql_const.h"
  #include "sql_time.h"
+ #include "sql_type_real.h"
 +#include "compat56.h"
  
  class Field;
  class Column_definition;
@@@ -4112,10 -1786,8 +4121,9 @@@ public
                                   Item_param *param,
                                   const Type_all_attributes *attr,
                                   const st_value *value) const;
 +  void Item_update_null_value(Item *item) const;
    int Item_save_in_field(Item *item, Field *field, bool no_conversions) const;
    Item *make_const_item_for_comparison(THD *, Item *src, const Item *cmp) const;
-   Item_cache *Item_get_cache(THD *thd, const Item *item) const;
    bool set_comparator_func(Arg_comparator *cmp) const;
    bool Item_hybrid_func_fix_attributes(THD *thd,
                                         const char *name,
@@@ -4145,12 -1814,9 +4151,11 @@@
    my_decimal *Item_func_hybrid_field_type_val_decimal(
                                                Item_func_hybrid_field_type *,
                                                my_decimal *) const;
 -  bool Item_func_hybrid_field_type_get_date(Item_func_hybrid_field_type *,
 +  void Item_func_hybrid_field_type_get_date(THD *,
 +                                            Item_func_hybrid_field_type *,
 +                                            Temporal::Warn *,
                                              MYSQL_TIME *,
 -                                            ulonglong fuzzydate) const;
 +                                            date_mode_t fuzzydate) const;
-   String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
    longlong Item_func_between_val_int(Item_func_between *func) const;
    cmp_item *make_cmp_item(THD *thd, CHARSET_INFO *cs) const;
    in_vector *make_in_vector(THD *, const Item_func_in *, uint nargs) const;
@@@ -5101,15 -2616,13 +5108,20 @@@ public
                            const Record_addr &addr,
                            const Type_all_attributes &attr,
                            TABLE *table) const;
 +  Field *make_table_field_from_def(TABLE_SHARE *share,
 +                                   MEM_ROOT *mem_root,
 +                                   const LEX_CSTRING *name,
 +                                   const Record_addr &addr,
 +                                   const Bit_addr &bit,
 +                                   const Column_definition_attributes *attr,
 +                                   uint32 flags) const;
    void Item_param_set_param_func(Item_param *param,
                                   uchar **pos, ulong len) const;
+ 
+   Item_cache *Item_get_cache(THD *thd, const Item *item) const;
+   String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
+                                               String *) const;
+   String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
  };
  
  
@@@ -5144,15 -2653,13 +5156,20 @@@ public
                            const Record_addr &addr,
                            const Type_all_attributes &attr,
                            TABLE *table) const;
 +  Field *make_table_field_from_def(TABLE_SHARE *share,
 +                                   MEM_ROOT *mem_root,
 +                                   const LEX_CSTRING *name,
 +                                   const Record_addr &addr,
 +                                   const Bit_addr &bit,
 +                                   const Column_definition_attributes *attr,
 +                                   uint32 flags) const;
    void Item_param_set_param_func(Item_param *param,
                                   uchar **pos, ulong len) const;
+ 
+   Item_cache *Item_get_cache(THD *thd, const Item *item) const;
+   String *Item_func_hybrid_field_type_val_str(Item_func_hybrid_field_type *,
+                                               String *) const;
+   String *Item_func_min_max_val_str(Item_func_min_max *, String *) const;
  };
  
  
diff --cc sql/sql_union.cc
index c32a6ee852f,6ab2619e8e2..41f4234c13d
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@@ -981,7 -982,7 +982,24 @@@ bool st_select_lex_unit::prepare(TABLE_
      types= first_sl->item_list;
      goto cont;
    }
-- 
++
++  if (sl->tvc && sl->order_list.elements &&
++      !sl->tvc->to_be_wrapped_as_with_tail())
++  {
++    if (thd->lex->context_analysis_only & CONTEXT_ANALYSIS_ONLY_VIEW)
++    {
++      sl->master_unit()->fake_select_lex= 0;
++      sl->master_unit()->saved_fake_select_lex= 0;
++    }
++    else
++    {
++      sl->order_list.empty();
++      sl->explicit_limit= 0;
++      sl->select_limit= 0;
++      sl->offset_limit= 0;
++    }
++  }
++
    for (;sl; sl= sl->next_select(), union_part_count++)
    {
      if (sl->tvc)
diff --cc sql/sql_update.cc
index 723a3f26dc9,681e3bb0b64..fe021e27505
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@@ -1639,9 -1533,12 +1639,12 @@@ int mysql_multi_update_prepare(THD *thd
    LEX *lex= thd->lex;
    TABLE_LIST *table_list= lex->query_tables;
    TABLE_LIST *tl;
 -  List<Item> *fields= &lex->select_lex.item_list;
 +  List<Item> *fields= &lex->first_select_lex()->item_list;
    table_map tables_for_update;
    bool update_view= 0;
+   DML_prelocking_strategy prelocking_strategy;
+   bool has_prelocking_list= thd->lex->requires_prelocking();
+ 
    /*
      if this multi-update was converted from usual update, here is table
      counter else junk will be assigned here, but then replaced with real
@@@ -1723,10 -1608,12 +1726,13 @@@
  
    thd->table_map_for_update= tables_for_update= get_table_map(fields);
  
 -  if (unsafe_key_update(lex->select_lex.leaf_tables, tables_for_update))
 +  if (unsafe_key_update(lex->first_select_lex()->leaf_tables,
 +                        tables_for_update))
      DBUG_RETURN(true);
  
+   TABLE_LIST **new_tables= lex->query_tables_last;
+   DBUG_ASSERT(*new_tables== NULL);
+ 
    /*
      Setup timestamp handling and locking mode
    */
diff --cc sql/sql_yacc.yy
index 70eb7803dba,f89984d848f..fd461ad05aa
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@@ -13289,15 -13417,11 +13290,15 @@@ insert
            insert_lock_option
            opt_ignore insert2
            {
-             Select->set_lock_for_tables($3);
+             Select->set_lock_for_tables($3, true);
 -            Lex->current_select= &Lex->select_lex;
 +            Lex->current_select= Lex->first_select_lex();
            }
            insert_field_spec opt_insert_update
 -          {}
 +          {
 +            Lex->pop_select(); //main select
 +            if (Lex->check_main_unit_semantics())
 +              MYSQL_YYABORT;
 +          }
          ;
  
  replace:
@@@ -13313,15 -13434,11 +13314,15 @@@
            }
            replace_lock_option insert2
            {
-             Select->set_lock_for_tables($3);
+             Select->set_lock_for_tables($3, true);
 -            Lex->current_select= &Lex->select_lex;
 +            Lex->current_select= Lex->first_select_lex();
            }
            insert_field_spec
 -          {}
 +          {
 +            Lex->pop_select(); //main select
 +            if (Lex->check_main_unit_semantics())
 +              MYSQL_YYABORT;
 +          }
          ;
  
  insert_lock_option:
@@@ -13583,13 -13664,13 +13584,13 @@@ update
              lex->sql_command= SQLCOM_UPDATE;
              lex->duplicates= DUP_ERROR; 
            }
 -          opt_low_priority opt_ignore join_table_list
 +          opt_low_priority opt_ignore update_table_list
            SET update_list
            {
-             LEX *lex= Lex;
-             if (lex->first_select_lex()->table_list.elements > 1)
-               lex->sql_command= SQLCOM_UPDATE_MULTI;
-             else if (lex->first_select_lex()->get_table_list()->derived)
 -            SELECT_LEX *slex= &Lex->select_lex;
++            SELECT_LEX *slex= Lex->first_select_lex();
+             if (slex->table_list.elements > 1)
+               Lex->sql_command= SQLCOM_UPDATE_MULTI;
 -            else if (unlikely(slex->get_table_list()->derived))
++            else if (slex->get_table_list()->derived)
              {
                /* it is single table update and it is update of derived table */
                my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
@@@ -13602,16 -13682,9 +13602,16 @@@
                be too pessimistic. We will decrease lock level if possible in
                mysql_multi_update().
              */
-             Select->set_lock_for_tables($3);
+             slex->set_lock_for_tables($3, slex->table_list.elements == 1);
            }
 -          opt_where_clause opt_order_clause delete_limit_clause {}
 +          opt_where_clause opt_order_clause delete_limit_clause
 +          {
 +            if ($10)
 +              Select->order_list= *($10);
 +            Lex->pop_select(); //main select
 +            if (Lex->check_main_unit_semantics())
 +              MYSQL_YYABORT;
 +          }
          ;
  
  update_list:
diff --cc sql/sql_yacc_ora.yy
index 7401e788c8e,6a05423ebc3..f6fd27bc183
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@@ -13427,15 -13378,11 +13428,15 @@@ insert
            insert_lock_option
            opt_ignore insert2
            {
-             Select->set_lock_for_tables($3);
+             Select->set_lock_for_tables($3, true);
 -            Lex->current_select= &Lex->select_lex;
 +            Lex->current_select= Lex->first_select_lex();
            }
            insert_field_spec opt_insert_update
 -          {}
 +          {
 +            Lex->pop_select(); //main select
 +            if (Lex->check_main_unit_semantics())
 +              MYSQL_YYABORT;
 +          }
          ;
  
  replace:
@@@ -13451,15 -13395,11 +13452,15 @@@
            }
            replace_lock_option insert2
            {
-             Select->set_lock_for_tables($3);
+             Select->set_lock_for_tables($3, true);
 -            Lex->current_select= &Lex->select_lex;
 +            Lex->current_select= Lex->first_select_lex();
            }
            insert_field_spec
 -          {}
 +          {
 +            Lex->pop_select(); //main select
 +            if (Lex->check_main_unit_semantics())
 +              MYSQL_YYABORT;
 +          }
          ;
  
  insert_lock_option:
@@@ -13721,13 -13625,13 +13722,13 @@@ update
              lex->sql_command= SQLCOM_UPDATE;
              lex->duplicates= DUP_ERROR; 
            }
 -          opt_low_priority opt_ignore join_table_list
 +          opt_low_priority opt_ignore update_table_list
            SET update_list
            {
-             LEX *lex= Lex;
-             if (lex->first_select_lex()->table_list.elements > 1)
-               lex->sql_command= SQLCOM_UPDATE_MULTI;
-             else if (lex->first_select_lex()->get_table_list()->derived)
 -            SELECT_LEX *slex= &Lex->select_lex;
++            SELECT_LEX *slex= Lex->first_select_lex();
+             if (slex->table_list.elements > 1)
+               Lex->sql_command= SQLCOM_UPDATE_MULTI;
 -            else if (unlikely(slex->get_table_list()->derived))
++            else if (slex->get_table_list()->derived)
              {
                /* it is single table update and it is update of derived table */
                my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
@@@ -13740,16 -13643,9 +13740,16 @@@
                be too pessimistic. We will decrease lock level if possible in
                mysql_multi_update().
              */
-             Select->set_lock_for_tables($3);
+             slex->set_lock_for_tables($3, slex->table_list.elements == 1);
            }
 -          opt_where_clause opt_order_clause delete_limit_clause {}
 +          opt_where_clause opt_order_clause delete_limit_clause
 +          {
 +            if ($10)
 +              Select->order_list= *($10);
 +            Lex->pop_select(); //main select
 +            if (Lex->check_main_unit_semantics())
 +              MYSQL_YYABORT;
 +          }
          ;
  
  update_list:
diff --cc sql/wsrep_applier.cc
index 39cdef77be2,9d39b36793f..fd51dbf9439
--- a/sql/wsrep_applier.cc
+++ b/sql/wsrep_applier.cc
@@@ -11,12 -11,9 +11,12 @@@
  
     You should have received a copy of the GNU General Public License along
     with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */
  
  #include "mariadb.h"
 +#include "mysql/service_wsrep.h"
 +#include "wsrep_applier.h"
 +
  #include "wsrep_priv.h"
  #include "wsrep_binlog.h" // wsrep_dump_rbr_buf()
  #include "wsrep_xid.h"
diff --cc sql/wsrep_binlog.cc
index 80790ca604c,412af259d98..ecab4664d7b
--- a/sql/wsrep_binlog.cc
+++ b/sql/wsrep_binlog.cc
@@@ -11,10 -11,9 +11,10 @@@
  
     You should have received a copy of the GNU General Public License along
     with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */
  
  #include "mariadb.h"
 +#include "mysql/service_wsrep.h"
  #include "wsrep_binlog.h"
  #include "wsrep_priv.h"
  #include "log.h"
diff --cc sql/wsrep_mysqld.cc
index dba793aba55,99cad458827..044db604afc
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@@ -11,15 -11,10 +11,15 @@@
  
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
  
  #include "sql_plugin.h"                         /* wsrep_plugins_pre_init() */
 +#include "my_global.h"
 +#include "wsrep_server_state.h"
 +
 +#include "mariadb.h"
  #include <mysqld.h>
 +#include <transaction.h>
  #include <sql_class.h>
  #include <sql_parse.h>
  #include <sql_base.h> /* find_temporary_table() */
diff --cc sql/wsrep_mysqld.h
index f71d998ed4e,c5749ef6da9..37301afa7be
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@@ -11,8 -11,10 +11,8 @@@
  
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
  
 -#include <wsrep.h>
 -
  #ifndef WSREP_MYSQLD_H
  #define WSREP_MYSQLD_H
  
diff --cc sql/wsrep_sst.h
index 46059a7f436,1ad8ff5b5de..eb218647bc0
--- a/sql/wsrep_sst.h
+++ b/sql/wsrep_sst.h
@@@ -11,8 -11,10 +11,8 @@@
  
     You should have received a copy of the GNU General Public License along
     with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */
  
 -#include <my_config.h>
 -
  #ifndef WSREP_SST_H
  #define WSREP_SST_H
  
diff --cc sql/wsrep_thd.h
index 3114e02e1b8,6ce14a4eb0e..2eceb3223a8
--- a/sql/wsrep_thd.h
+++ b/sql/wsrep_thd.h
@@@ -11,8 -11,10 +11,8 @@@
  
     You should have received a copy of the GNU General Public License along
     with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */
  
 -#include <my_config.h>
 -
  #ifndef WSREP_THD_H
  #define WSREP_THD_H
  
diff --cc sql/wsrep_var.h
index 0acb61432f0,6258b5ab66f..481df02f2d5
--- a/sql/wsrep_var.h
+++ b/sql/wsrep_var.h
@@@ -11,8 -11,10 +11,8 @@@
  
     You should have received a copy of the GNU General Public License along
     with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */
  
 -#include <my_config.h>
 -
  #ifndef WSREP_VAR_H
  #define WSREP_VAR_H
  
diff --cc storage/innobase/buf/buf0dblwr.cc
index fb3d4d96003,8edc4768383..80c7411d48a
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@@ -635,26 -646,16 +635,21 @@@ bad
  				<< " from the doublewrite buffer.";
  		}
  
 -		ulint decomp = fil_page_decompress(buf, page);
 -		if (!decomp || (decomp != srv_page_size
 -				&& page_size.is_compressed())) {
 +		ulint decomp = fil_page_decompress(buf, page, space->flags);
 +		if (!decomp || (zip_size && decomp != srv_page_size)) {
- 			goto bad_doublewrite;
+ 			continue;
  		}
  
 -		if (expect_encrypted && mach_read_from_4(
 -			    page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
 -		    ? !fil_space_verify_crypt_checksum(page, page_size)
 -		    : buf_page_is_corrupted(true, page, page_size, space)) {
 +		if (expect_encrypted
 +		    && buf_page_get_key_version(read_buf, space->flags)) {
 +			is_corrupted = !buf_page_verify_crypt_checksum(
 +						page, space->flags);
 +		} else {
 +			is_corrupted = buf_page_is_corrupted(
 +					true, page, space->flags);
 +		}
 +
 +		if (is_corrupted) {
- 			if (!is_all_zero) {
- bad_doublewrite:
- 				ib::warn() << "A doublewrite copy of page "
- 					<< page_id << " is corrupted.";
- 			}
  			/* Theoretically we could have another good
  			copy for this page in the doublewrite
  			buffer. If not, we will report a fatal error
diff --cc storage/innobase/fts/fts0sql.cc
index 26a51b74fff,f9b7a59d675..a38c3f7a488
--- a/storage/innobase/fts/fts0sql.cc
+++ b/storage/innobase/fts/fts0sql.cc
@@@ -88,70 -89,52 +89,52 @@@ fts_get_table_id
  	return(len);
  }
  
- /******************************************************************//**
- Construct the prefix name of an FTS table.
- @return own: table name, must be freed with ut_free() */
- char*
- fts_get_table_name_prefix(
- /*======================*/
- 	const fts_table_t*
- 			fts_table)	/*!< in: Auxiliary table type */
+ /** Construct the name of an internal FTS table for the given table.
+ @param[in]	fts_table	metadata on fulltext-indexed table
 - at param[in]	dict_locked	whether dict_sys->mutex is being held
++ at param[in]	dict_locked	whether dict_sys.mutex is being held
+ @return	the prefix, must be freed with ut_free() */
+ char* fts_get_table_name_prefix(const fts_table_t* fts_table)
  {
- 	int		len;
- 	const char*	slash;
- 	char*		prefix_name;
- 	int		dbname_len = 0;
- 	int		prefix_name_len;
  	char		table_id[FTS_AUX_MIN_TABLE_ID_LENGTH];
- 
- 	slash = static_cast<const char*>(
- 		memchr(fts_table->parent, '/', strlen(fts_table->parent)));
- 
- 	if (slash) {
- 		/* Print up to and including the separator. */
- 		dbname_len = static_cast<int>(slash - fts_table->parent) + 1;
- 	}
- 
- 	len = fts_get_table_id(fts_table, table_id);
- 
- 	prefix_name_len = dbname_len + 4 + len + 1;
- 
- 	prefix_name = static_cast<char*>(
- 		ut_malloc_nokey(unsigned(prefix_name_len)));
- 
- 	len = sprintf(prefix_name, "%.*sFTS_%s",
- 		      dbname_len, fts_table->parent, table_id);
- 
- 	ut_a(len > 0);
- 	ut_a(len == prefix_name_len - 1);
- 
- 	return(prefix_name);
+ 	const size_t table_id_len = size_t(fts_get_table_id(fts_table,
+ 							    table_id)) + 1;
 -	mutex_enter(&dict_sys->mutex);
++	mutex_enter(&dict_sys.mutex);
+ 	/* Include the separator as well. */
+ 	const size_t dbname_len = fts_table->table->name.dblen() + 1;
+ 	ut_ad(dbname_len > 1);
+ 	const size_t prefix_name_len = dbname_len + 4 + table_id_len;
+ 	char* prefix_name = static_cast<char*>(
+ 		ut_malloc_nokey(prefix_name_len));
+ 	memcpy(prefix_name, fts_table->table->name.m_name, dbname_len);
 -	mutex_exit(&dict_sys->mutex);
++	mutex_exit(&dict_sys.mutex);
+ 	memcpy(prefix_name + dbname_len, "FTS_", 4);
+ 	memcpy(prefix_name + dbname_len + 4, table_id, table_id_len);
+ 	return prefix_name;
  }
  
- /******************************************************************//**
- Construct the name of an ancillary FTS table for the given table.
- Caller must allocate enough memory(usually size of MAX_FULL_NAME_LEN)
- for param 'table_name'. */
- void
- fts_get_table_name(
- /*===============*/
- 	const fts_table_t*	fts_table,
- 					/*!< in: Auxiliary table type */
- 	char*			table_name)
- 					/*!< in/out: aux table name */
+ /** Construct the name of an internal FTS table for the given table.
+ @param[in]	fts_table	metadata on fulltext-indexed table
+ @param[out]	table_name	a name up to MAX_FULL_NAME_LEN
 - at param[in]	dict_locked	whether dict_sys->mutex is being held */
++ at param[in]	dict_locked	whether dict_sys.mutex is being held */
+ void fts_get_table_name(const fts_table_t* fts_table, char* table_name,
+ 			bool dict_locked)
  {
- 	int		len;
- 	char*		prefix_name;
- 
- 	prefix_name = fts_get_table_name_prefix(fts_table);
- 
- 	len = sprintf(table_name, "%s_%s", prefix_name, fts_table->suffix);
- 
- 	ut_a(len > 0);
- 	ut_a(strlen(prefix_name) + 1 + strlen(fts_table->suffix)
- 	     == static_cast<uint>(len));
- 
- 	ut_free(prefix_name);
+ 	if (!dict_locked) {
 -		mutex_enter(&dict_sys->mutex);
++		mutex_enter(&dict_sys.mutex);
+ 	}
 -	ut_ad(mutex_own(&dict_sys->mutex));
++	ut_ad(mutex_own(&dict_sys.mutex));
+ 	/* Include the separator as well. */
+ 	const size_t dbname_len = fts_table->table->name.dblen() + 1;
+ 	ut_ad(dbname_len > 1);
+ 	memcpy(table_name, fts_table->table->name.m_name, dbname_len);
+ 	if (!dict_locked) {
 -		mutex_exit(&dict_sys->mutex);
++		mutex_exit(&dict_sys.mutex);
+ 	}
+ 	memcpy(table_name += dbname_len, "FTS_", 4);
+ 	table_name += 4;
+ 	table_name += fts_get_table_id(fts_table, table_name);
+ 	*table_name++ = '_';
+ 	strcpy(table_name, fts_table->suffix);
  }
  
  /******************************************************************//**
diff --cc storage/innobase/handler/ha_innodb.h
index af81b22f879,ad30ae800cc..11b69974558
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@@ -13,12 -13,13 +13,12 @@@ FOR A PARTICULAR PURPOSE. See the GNU G
  
  You should have received a copy of the GNU General Public License along with
  this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
  
  *****************************************************************************/
 -
  #ifdef WITH_WSREP
 -# include <mysql/service_wsrep.h>
 -# include "../../../wsrep/wsrep_api.h"
 +#include "wsrep_api.h"
 +#include <mysql/service_wsrep.h>
  #endif /* WITH_WSREP */
  
  #include "table.h"
diff --cc storage/innobase/handler/handler0alter.cc
index a8cf53b5033,0d0e597641b..cb7d0455290
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@@ -1025,9 -296,9 +1026,12 @@@ struct ha_innobase_inplace_ctx : publi
  				rw_lock_free(&index->lock);
  				dict_mem_index_free(index);
  			}
 +			for (unsigned i = old_n_v_cols; i--; ) {
 +				UT_DELETE(old_v_cols[i].v_indexes);
 +			}
+ 			if (instant_table->fts) {
+ 				fts_free(instant_table);
+ 			}
  			dict_mem_table_free(instant_table);
  		}
  		mem_heap_free(heap);
@@@ -1093,40 -348,23 +1097,57 @@@
  		return instant_table;
  	}
  
 +	/** Create an index table where indexes are ordered as follows:
 +
 +	IF a new primary key is defined for the table THEN
 +
 +		1) New primary key
 +		2) The remaining keys in key_info
 +
 +	ELSE
 +
 +		1) All new indexes in the order they arrive from MySQL
 +
 +	ENDIF
 +
 +	@return key definitions */
 +	MY_ATTRIBUTE((nonnull, warn_unused_result, malloc))
 +	inline index_def_t*
 +	create_key_defs(
 +		const Alter_inplace_info*	ha_alter_info,
 +				/*!< in: alter operation */
 +		const TABLE*			altered_table,
 +				/*!< in: MySQL table that is being altered */
 +		ulint&				n_fts_add,
 +				/*!< out: number of FTS indexes to be created */
 +		ulint&				fts_doc_id_col,
 +				/*!< in: The column number for Doc ID */
 +		bool&				add_fts_doc_id,
 +				/*!< in: whether we need to add new DOC ID
 +				column for FTS index */
 +		bool&				add_fts_doc_idx,
 +				/*!< in: whether we need to add new DOC ID
 +				index for FTS index */
 +		const TABLE*			table);
 +				/*!< in: MySQL table that is being altered */
 +
+ 	/** Share context between partitions.
+ 	@param[in] ctx	context from another partition of the table */
+ 	void set_shared_data(const inplace_alter_handler_ctx& ctx)
+ 	{
+ 		if (add_autoinc != ULINT_UNDEFINED) {
+ 			const ha_innobase_inplace_ctx& ha_ctx =
+ 				static_cast<const ha_innobase_inplace_ctx&>
+ 				(ctx);
+ 			/* When adding an AUTO_INCREMENT column to a
+ 			partitioned InnoDB table, we must share the
+ 			sequence for all partitions. */
+ 			ut_ad(ha_ctx.add_autoinc == add_autoinc);
+ 			ut_ad(ha_ctx.sequence.last());
+ 			sequence = ha_ctx.sequence;
+ 		}
+ 	}
+ 
  private:
  	// Disable copying
  	ha_innobase_inplace_ctx(const ha_innobase_inplace_ctx&);
@@@ -8254,7 -6916,10 +8275,9 @@@ ha_innobase::inplace_alter_table
  	bool			rebuild_templ = false;
  	DBUG_ENTER("inplace_alter_table");
  	DBUG_ASSERT(!srv_read_only_mode);
 -
  	ut_ad(!sync_check_iterate(sync_check()));
 -	ut_ad(!rw_lock_own_flagged(&dict_operation_lock,
++	ut_ad(!rw_lock_own_flagged(&dict_sys.latch,
+ 				   RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
  
  	DEBUG_SYNC(m_user_thd, "innodb_inplace_alter_table_enter");
  
diff --cc storage/innobase/handler/i_s.cc
index 110bf8bb119,79c0fa1aa3f..c06a6ef83f9
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@@ -2864,25 -2867,21 +2867,21 @@@ i_s_fts_deleted_generic_fill
  		DBUG_RETURN(0);
  	}
  
- 	if (!fts_internal_tbl_name) {
- 		DBUG_RETURN(0);
- 	}
+ 	RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
  
- 	/* Prevent DDL to drop fts aux tables. */
+ 	/* Prevent DROP of the internal tables for fulltext indexes.
+ 	FIXME: acquire DDL-blocking MDL on the user table name! */
 -	rw_lock_s_lock(&dict_operation_lock);
 +	rw_lock_s_lock(&dict_sys.latch);
  
- 	user_table = dict_table_open_on_name(
- 		fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE);
+ 	user_table = dict_table_open_on_id(
+ 		innodb_ft_aux_table_id, FALSE, DICT_TABLE_OP_NORMAL);
  
  	if (!user_table) {
 -		rw_lock_s_unlock(&dict_operation_lock);
 +		rw_lock_s_unlock(&dict_sys.latch);
- 
  		DBUG_RETURN(0);
  	} else if (!dict_table_has_fts_index(user_table)) {
  		dict_table_close(user_table, FALSE, FALSE);
- 
 -		rw_lock_s_unlock(&dict_operation_lock);
 +		rw_lock_s_unlock(&dict_sys.latch);
- 
  		DBUG_RETURN(0);
  	}
  
@@@ -2897,6 -2896,12 +2896,12 @@@
  
  	fts_table_fetch_doc_ids(trx, &fts_table, deleted);
  
+ 	dict_table_close(user_table, FALSE, FALSE);
+ 
 -	rw_lock_s_unlock(&dict_operation_lock);
++	rw_lock_s_unlock(&dict_sys.latch);
+ 
+ 	trx_free(trx);
+ 
  	fields = table->field;
  
  	int	ret = 0;
@@@ -3278,14 -3277,18 +3277,18 @@@ i_s_fts_index_cache_fill
  		DBUG_RETURN(0);
  	}
  
- 	if (!fts_internal_tbl_name) {
- 		DBUG_RETURN(0);
- 	}
+ 	RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
  
- 	user_table = dict_table_open_on_name(
- 		fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE);
+ 	/* Prevent DROP of the internal tables for fulltext indexes.
+ 	FIXME: acquire DDL-blocking MDL on the user table name! */
 -	rw_lock_s_lock(&dict_operation_lock);
++	rw_lock_s_lock(&dict_sys.latch);
+ 
+ 	user_table = dict_table_open_on_id(
+ 		innodb_ft_aux_table_id, FALSE, DICT_TABLE_OP_NORMAL);
  
  	if (!user_table) {
+ no_fts:
 -		rw_lock_s_unlock(&dict_operation_lock);
++		rw_lock_s_unlock(&dict_sys.latch);
  		DBUG_RETURN(0);
  	}
  
@@@ -3315,9 -3315,8 +3315,8 @@@
  				 index_cache, thd, &conv_str, tables));
  	}
  
- 	ut_free(conv_str.f_str);
- 
  	dict_table_close(user_table, FALSE, FALSE);
 -	rw_lock_s_unlock(&dict_operation_lock);
++	rw_lock_s_unlock(&dict_sys.latch);
  
  	DBUG_RETURN(ret);
  }
@@@ -3725,19 -3724,17 +3724,17 @@@ i_s_fts_index_table_fill
  		DBUG_RETURN(0);
  	}
  
- 	if (!fts_internal_tbl_name) {
- 		DBUG_RETURN(0);
- 	}
+ 	RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
  
- 	/* Prevent DDL to drop fts aux tables. */
+ 	/* Prevent DROP of the internal tables for fulltext indexes.
+ 	FIXME: acquire DDL-blocking MDL on the user table name! */
 -	rw_lock_s_lock(&dict_operation_lock);
 +	rw_lock_s_lock(&dict_sys.latch);
  
- 	user_table = dict_table_open_on_name(
- 		fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE);
+ 	user_table = dict_table_open_on_id(
+ 		innodb_ft_aux_table_id, FALSE, DICT_TABLE_OP_NORMAL);
  
  	if (!user_table) {
 -		rw_lock_s_unlock(&dict_operation_lock);
 +		rw_lock_s_unlock(&dict_sys.latch);
- 
  		DBUG_RETURN(0);
  	}
  
@@@ -3890,32 -3887,28 +3887,28 @@@ i_s_fts_config_fill
  		DBUG_RETURN(0);
  	}
  
- 	if (!fts_internal_tbl_name) {
- 		DBUG_RETURN(0);
- 	}
- 
- 	DEBUG_SYNC_C("i_s_fts_config_fille_check");
- 
- 	fields = table->field;
+ 	RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
  
- 	/* Prevent DDL to drop fts aux tables. */
+ 	/* Prevent DROP of the internal tables for fulltext indexes.
+ 	FIXME: acquire DDL-blocking MDL on the user table name! */
 -	rw_lock_s_lock(&dict_operation_lock);
 +	rw_lock_s_lock(&dict_sys.latch);
  
- 	user_table = dict_table_open_on_name(
- 		fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE);
+ 	user_table = dict_table_open_on_id(
+ 		innodb_ft_aux_table_id, FALSE, DICT_TABLE_OP_NORMAL);
  
  	if (!user_table) {
+ no_fts:
 -		rw_lock_s_unlock(&dict_operation_lock);
 +		rw_lock_s_unlock(&dict_sys.latch);
- 
  		DBUG_RETURN(0);
- 	} else if (!dict_table_has_fts_index(user_table)) {
- 		dict_table_close(user_table, FALSE, FALSE);
- 
- 		rw_lock_s_unlock(&dict_sys.latch);
+ 	}
  
- 		DBUG_RETURN(0);
+ 	if (!dict_table_has_fts_index(user_table)) {
+ 		dict_table_close(user_table, FALSE, FALSE);
+ 		goto no_fts;
  	}
  
+ 	fields = table->field;
+ 
  	trx = trx_create();
  	trx->op_info = "Select for FTS CONFIG TABLE";
  
@@@ -3967,12 -3960,12 +3960,12 @@@
  
  	fts_sql_commit(trx);
  
- 	trx_free(trx);
- 
  	dict_table_close(user_table, FALSE, FALSE);
  
 -	rw_lock_s_unlock(&dict_operation_lock);
 +	rw_lock_s_unlock(&dict_sys.latch);
  
+ 	trx_free(trx);
+ 
  	DBUG_RETURN(ret);
  }
  
diff --cc storage/innobase/include/fts0fts.h
index bea58476e8b,b3ea718b14a..b5c81250c28
--- a/storage/innobase/include/fts0fts.h
+++ b/storage/innobase/include/fts0fts.h
@@@ -402,16 -396,11 +396,11 @@@ extern ulong		fts_min_token_size
  need a sync to free some memory */
  extern bool		fts_need_sync;
  
- /** Variable specifying the table that has Fulltext index to display its
- content through information schema table */
- extern char*		fts_internal_tbl_name;
- extern char*		fts_internal_tbl_name2;
- 
  #define	fts_que_graph_free(graph)			\
  do {							\
 -	mutex_enter(&dict_sys->mutex);			\
 +	mutex_enter(&dict_sys.mutex);			\
  	que_graph_free(graph);				\
 -	mutex_exit(&dict_sys->mutex);			\
 +	mutex_exit(&dict_sys.mutex);			\
  } while (0)
  
  /******************************************************************//**
diff --cc storage/innobase/include/fts0priv.h
index 85331cbd31e,40978ea3f1c..f41280c22f8
--- a/storage/innobase/include/fts0priv.h
+++ b/storage/innobase/include/fts0priv.h
@@@ -131,19 -130,15 +130,15 @@@ fts_eval_sql
  /*=========*/
  	trx_t*		trx,		/*!< in: transaction */
  	que_t*		graph)		/*!< in: Parsed statement */
- 	MY_ATTRIBUTE((warn_unused_result));
- 
- /******************************************************************//**
- Construct the name of an ancillary FTS table for the given table.
- Caller must allocate enough memory(usually size of MAX_FULL_NAME_LEN)
- for param 'table_name'. */
- void
- fts_get_table_name(
- /*===============*/
- 	const fts_table_t*
- 			fts_table,	/*!< in: FTS aux table info */
- 	char*		table_name);	/*!< in/out: aux table name */
+ 	MY_ATTRIBUTE((nonnull, warn_unused_result));
  
+ /** Construct the name of an internal FTS table for the given table.
+ @param[in]	fts_table	metadata on fulltext-indexed table
+ @param[out]	table_name	a name up to MAX_FULL_NAME_LEN
 - at param[in]	dict_locked	whether dict_sys->mutex is being held */
++ at param[in]	dict_locked	whether dict_sys.mutex is being held */
+ void fts_get_table_name(const fts_table_t* fts_table, char* table_name,
+ 			bool dict_locked = false)
+ 	MY_ATTRIBUTE((nonnull));
  /******************************************************************//**
  Construct the column specification part of the SQL string for selecting the
  indexed FTS columns for the given table. Adds the necessary bound
@@@ -508,18 -500,13 +500,13 @@@ fts_get_table_id
  	char*		table_id)	/*!< out: table id, must be at least
  					FTS_AUX_MIN_TABLE_ID_LENGTH bytes
  					long */
- 	MY_ATTRIBUTE((warn_unused_result));
- 
- /******************************************************************//**
- Construct the prefix name of an FTS table.
- @return own: table name, must be freed with ut_free() */
- char*
- fts_get_table_name_prefix(
- /*======================*/
- 	const fts_table_t*
- 			fts_table)	/*!< in: Auxiliary table type */
- 	MY_ATTRIBUTE((warn_unused_result));
- 
+ 	MY_ATTRIBUTE((nonnull, warn_unused_result));
+ /** Construct the name of an internal FTS table for the given table.
+ @param[in]	fts_table	metadata on fulltext-indexed table
 - at param[in]	dict_locked	whether dict_sys->mutex is being held
++ at param[in]	dict_locked	whether dict_sys.mutex is being held
+ @return	the prefix, must be freed with ut_free() */
+ char* fts_get_table_name_prefix(const fts_table_t* fts_table)
+ 	MY_ATTRIBUTE((nonnull, malloc, warn_unused_result));
  /******************************************************************//**
  Add node positions. */
  void
diff --cc storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result
index 00000000000,8d5b6270318..cb31847cdd8
mode 000000,100644..100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result
@@@ -1,0 -1,344 +1,342 @@@
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX;
+ trx_id	trx_state	trx_started	trx_requested_lock_id	trx_wait_started	trx_weight	trx_mysql_thread_id	trx_query	trx_operation_state	trx_tables_in_use	trx_tables_locked	trx_lock_structs	trx_lock_memory_bytes	trx_rows_locked	trx_rows_modified	trx_concurrency_tickets	trx_isolation_level	trx_unique_checks	trx_foreign_key_checks	trx_last_foreign_key_error	trx_is_read_only	trx_autocommit_non_locking
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
+ lock_id	lock_trx_id	lock_mode	lock_type	lock_table	lock_index	lock_space	lock_page	lock_rec	lock_data
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
+ requesting_trx_id	requested_lock_id	blocking_trx_id	blocking_lock_id
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP;
+ page_size	compress_ops	compress_ops_ok	compress_time	uncompress_ops	uncompress_time
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_RESET;
+ page_size	compress_ops	compress_ops_ok	compress_time	uncompress_ops	uncompress_time
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX;
+ database_name	table_name	index_name	compress_ops	compress_ops_ok	compress_time	uncompress_ops	uncompress_time
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX_RESET;
+ database_name	table_name	index_name	compress_ops	compress_ops_ok	compress_time	uncompress_ops	uncompress_time
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM;
+ page_size	buffer_pool_instance	pages_used	pages_free	relocation_ops	relocation_time
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM_RESET;
+ page_size	buffer_pool_instance	pages_used	pages_free	relocation_ops	relocation_time
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS;
+ NAME	SUBSYSTEM	COUNT	MAX_COUNT	MIN_COUNT	AVG_COUNT	COUNT_RESET	MAX_COUNT_RESET	MIN_COUNT_RESET	AVG_COUNT_RESET	TIME_ENABLED	TIME_DISABLED	TIME_ELAPSED	TIME_RESET	STATUS	TYPE	COMMENT
+ metadata_table_handles_opened	metadata	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of table handles opened
+ metadata_table_handles_closed	metadata	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of table handles closed
+ metadata_table_reference_count	metadata	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Table reference counter
+ lock_deadlocks	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of deadlocks
+ lock_timeouts	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of lock timeouts
+ lock_rec_lock_waits	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of times enqueued into record lock wait queue
+ lock_table_lock_waits	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of times enqueued into table lock wait queue
+ lock_rec_lock_requests	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of record locks requested
+ lock_rec_lock_created	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of record locks created
+ lock_rec_lock_removed	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of record locks removed from the lock queue
+ lock_rec_locks	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Current number of record locks on tables
+ lock_table_lock_created	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of table locks created
+ lock_table_lock_removed	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of table locks removed from the lock queue
+ lock_table_locks	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Current number of table locks on tables
+ lock_row_lock_current_waits	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of row locks currently being waited for (innodb_row_lock_current_waits)
+ lock_row_lock_time	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Time spent in acquiring row locks, in milliseconds (innodb_row_lock_time)
+ lock_row_lock_time_max	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	The maximum time to acquire a row lock, in milliseconds (innodb_row_lock_time_max)
+ lock_row_lock_waits	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of times a row lock had to be waited for (innodb_row_lock_waits)
+ lock_row_lock_time_avg	lock	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	The average time to acquire a row lock, in milliseconds (innodb_row_lock_time_avg)
+ buffer_pool_size	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Server buffer pool size (all buffer pools) in bytes
+ buffer_pool_reads	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of reads directly from disk (innodb_buffer_pool_reads)
+ buffer_pool_read_requests	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of logical read requests (innodb_buffer_pool_read_requests)
+ buffer_pool_write_requests	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of write requests (innodb_buffer_pool_write_requests)
+ buffer_pool_wait_free	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of times waited for free buffer (innodb_buffer_pool_wait_free)
+ buffer_pool_read_ahead	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of pages read as read ahead (innodb_buffer_pool_read_ahead)
+ buffer_pool_read_ahead_evicted	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Read-ahead pages evicted without being accessed (innodb_buffer_pool_read_ahead_evicted)
+ buffer_pool_pages_total	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Total buffer pool size in pages (innodb_buffer_pool_pages_total)
+ buffer_pool_pages_misc	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Buffer pages for misc use such as row locks or the adaptive hash index (innodb_buffer_pool_pages_misc)
+ buffer_pool_pages_data	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Buffer pages containing data (innodb_buffer_pool_pages_data)
+ buffer_pool_bytes_data	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Buffer bytes containing data (innodb_buffer_pool_bytes_data)
+ buffer_pool_pages_dirty	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Buffer pages currently dirty (innodb_buffer_pool_pages_dirty)
+ buffer_pool_bytes_dirty	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Buffer bytes currently dirty (innodb_buffer_pool_bytes_dirty)
+ buffer_pool_pages_free	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Buffer pages currently free (innodb_buffer_pool_pages_free)
+ buffer_pages_created	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of pages created (innodb_pages_created)
+ buffer_pages_written	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of pages written (innodb_pages_written)
+ buffer_index_pages_written	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of index pages written (innodb_index_pages_written)
+ buffer_non_index_pages_written	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of non index pages written (innodb_non_index_pages_written)
+ buffer_pages_read	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of pages read (innodb_pages_read)
 -buffer_pages0_read	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of page 0 read (innodb_pages0_read)
+ buffer_index_sec_rec_cluster_reads	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of secondary record reads triggered cluster read
+ buffer_index_sec_rec_cluster_reads_avoided	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of secondary record reads avoided triggering cluster read
+ buffer_data_reads	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Amount of data read in bytes (innodb_data_reads)
+ buffer_data_written	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Amount of data written in bytes (innodb_data_written)
+ buffer_flush_batch_scanned	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_owner	Total pages scanned as part of flush batch
+ buffer_flush_batch_num_scan	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Number of times buffer flush list flush is called
+ buffer_flush_batch_scanned_per_call	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Pages scanned per flush batch scan
+ buffer_flush_batch_total_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_owner	Total pages flushed as part of flush batch
+ buffer_flush_batches	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Number of flush batches
+ buffer_flush_batch_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Pages queued as a flush batch
+ buffer_flush_neighbor_total_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_owner	Total neighbors flushed as part of neighbor flush
+ buffer_flush_neighbor	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Number of times neighbors flushing is invoked
+ buffer_flush_neighbor_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Pages queued as a neighbor batch
+ buffer_flush_n_to_flush_requested	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of pages requested for flushing.
+ buffer_flush_n_to_flush_by_age	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of pages target by LSN Age for flushing.
+ buffer_flush_adaptive_avg_time_slot	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Avg time (ms) spent for adaptive flushing recently per slot.
+ buffer_LRU_batch_flush_avg_time_slot	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Avg time (ms) spent for LRU batch flushing recently per slot.
+ buffer_flush_adaptive_avg_time_thread	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Avg time (ms) spent for adaptive flushing recently per thread.
+ buffer_LRU_batch_flush_avg_time_thread	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Avg time (ms) spent for LRU batch flushing recently per thread.
+ buffer_flush_adaptive_avg_time_est	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Estimated time (ms) spent for adaptive flushing recently.
+ buffer_LRU_batch_flush_avg_time_est	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Estimated time (ms) spent for LRU batch flushing recently.
+ buffer_flush_avg_time	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Avg time (ms) spent for flushing recently.
+ buffer_flush_adaptive_avg_pass	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Numner of adaptive flushes passed during the recent Avg period.
+ buffer_LRU_batch_flush_avg_pass	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of LRU batch flushes passed during the recent Avg period.
+ buffer_flush_avg_pass	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of flushes passed during the recent Avg period.
+ buffer_LRU_get_free_loops	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Total loops in LRU get free.
+ buffer_LRU_get_free_waits	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Total sleep waits in LRU get free.
+ buffer_flush_avg_page_rate	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Average number of pages at which flushing is happening
+ buffer_flush_lsn_avg_rate	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Average redo generation rate
+ buffer_flush_pct_for_dirty	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Percent of IO capacity used to avoid max dirty page limit
+ buffer_flush_pct_for_lsn	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Percent of IO capacity used to avoid reusable redo space limit
+ buffer_flush_sync_waits	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of times a wait happens due to sync flushing
+ buffer_flush_adaptive_total_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_owner	Total pages flushed as part of adaptive flushing
+ buffer_flush_adaptive	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Number of adaptive batches
+ buffer_flush_adaptive_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Pages queued as an adaptive batch
+ buffer_flush_sync_total_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_owner	Total pages flushed as part of sync batches
+ buffer_flush_sync	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Number of sync batches
+ buffer_flush_sync_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Pages queued as a sync batch
+ buffer_flush_background_total_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_owner	Total pages flushed as part of background batches
+ buffer_flush_background	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Number of background batches
+ buffer_flush_background_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Pages queued as a background batch
+ buffer_LRU_batch_scanned	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_owner	Total pages scanned as part of LRU batch
+ buffer_LRU_batch_num_scan	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Number of times LRU batch is called
+ buffer_LRU_batch_scanned_per_call	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Pages scanned per LRU batch call
+ buffer_LRU_batch_flush_total_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_owner	Total pages flushed as part of LRU batches
+ buffer_LRU_batches_flush	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Number of LRU batches
+ buffer_LRU_batch_flush_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Pages queued as an LRU batch
+ buffer_LRU_batch_evict_total_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_owner	Total pages evicted as part of LRU batches
+ buffer_LRU_batches_evict	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Number of LRU batches
+ buffer_LRU_batch_evict_pages	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Pages queued as an LRU batch
+ buffer_LRU_single_flush_scanned	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_owner	Total pages scanned as part of single page LRU flush
+ buffer_LRU_single_flush_num_scan	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Number of times single page LRU flush is called
+ buffer_LRU_single_flush_scanned_per_call	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Page scanned per single LRU flush
+ buffer_LRU_single_flush_failure_count	Buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of times attempt to flush a single page from LRU failed
+ buffer_LRU_get_free_search	Buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of searches performed for a clean page
+ buffer_LRU_search_scanned	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_owner	Total pages scanned as part of LRU search
+ buffer_LRU_search_num_scan	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Number of times LRU search is performed
+ buffer_LRU_search_scanned_per_call	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Page scanned per single LRU search
+ buffer_LRU_unzip_search_scanned	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_owner	Total pages scanned as part of LRU unzip search
+ buffer_LRU_unzip_search_num_scan	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Number of times LRU unzip search is performed
+ buffer_LRU_unzip_search_scanned_per_call	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	set_member	Page scanned per single LRU unzip search
+ buffer_page_read_index_leaf	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Index Leaf Pages read
+ buffer_page_read_index_non_leaf	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Index Non-leaf Pages read
+ buffer_page_read_index_ibuf_leaf	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Insert Buffer Index Leaf Pages read
+ buffer_page_read_index_ibuf_non_leaf	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Insert Buffer Index Non-Leaf Pages read
+ buffer_page_read_undo_log	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Undo Log Pages read
+ buffer_page_read_index_inode	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Index Inode Pages read
+ buffer_page_read_ibuf_free_list	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Insert Buffer Free List Pages read
+ buffer_page_read_ibuf_bitmap	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Insert Buffer Bitmap Pages read
+ buffer_page_read_system_page	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of System Pages read
+ buffer_page_read_trx_system	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Transaction System Pages read
+ buffer_page_read_fsp_hdr	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of File Space Header Pages read
+ buffer_page_read_xdes	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Extent Descriptor Pages read
+ buffer_page_read_blob	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Uncompressed BLOB Pages read
+ buffer_page_read_zblob	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of First Compressed BLOB Pages read
+ buffer_page_read_zblob2	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Subsequent Compressed BLOB Pages read
+ buffer_page_read_other	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of other/unknown (old version of InnoDB) Pages read
+ buffer_page_written_index_leaf	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Index Leaf Pages written
+ buffer_page_written_index_non_leaf	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Index Non-leaf Pages written
+ buffer_page_written_index_ibuf_leaf	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Insert Buffer Index Leaf Pages written
+ buffer_page_written_index_ibuf_non_leaf	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Insert Buffer Index Non-Leaf Pages written
+ buffer_page_written_undo_log	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Undo Log Pages written
+ buffer_page_written_index_inode	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Index Inode Pages written
+ buffer_page_written_ibuf_free_list	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Insert Buffer Free List Pages written
+ buffer_page_written_ibuf_bitmap	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Insert Buffer Bitmap Pages written
+ buffer_page_written_system_page	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of System Pages written
+ buffer_page_written_trx_system	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Transaction System Pages written
+ buffer_page_written_fsp_hdr	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of File Space Header Pages written
+ buffer_page_written_xdes	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Extent Descriptor Pages written
+ buffer_page_written_blob	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Uncompressed BLOB Pages written
+ buffer_page_written_zblob	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of First Compressed BLOB Pages written
+ buffer_page_written_zblob2	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Subsequent Compressed BLOB Pages written
+ buffer_page_written_other	buffer_page_io	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of other/unknown (old version InnoDB) Pages written
+ os_data_reads	os	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of reads initiated (innodb_data_reads)
+ os_data_writes	os	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of writes initiated (innodb_data_writes)
+ os_data_fsyncs	os	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of fsync() calls (innodb_data_fsyncs)
+ os_pending_reads	os	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of reads pending
+ os_pending_writes	os	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of writes pending
+ os_log_bytes_written	os	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Bytes of log written (innodb_os_log_written)
+ os_log_fsyncs	os	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of fsync log writes (innodb_os_log_fsyncs)
+ os_log_pending_fsyncs	os	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of pending fsync write (innodb_os_log_pending_fsyncs)
+ os_log_pending_writes	os	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of pending log file writes (innodb_os_log_pending_writes)
+ trx_rw_commits	transaction	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of read-write transactions  committed
+ trx_ro_commits	transaction	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of read-only transactions committed
+ trx_nl_ro_commits	transaction	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of non-locking auto-commit read-only transactions committed
+ trx_commits_insert_update	transaction	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of transactions committed with inserts and updates
+ trx_rollbacks	transaction	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of transactions rolled back
+ trx_rollbacks_savepoint	transaction	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of transactions rolled back to savepoint
 -trx_rollback_active	transaction	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of resurrected active transactions rolled back
+ trx_active_transactions	transaction	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of active transactions
+ trx_rseg_history_len	transaction	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Length of the TRX_RSEG_HISTORY list
+ trx_undo_slots_used	transaction	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of undo slots used
+ trx_undo_slots_cached	transaction	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of undo slots cached
+ trx_rseg_current_size	transaction	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Current rollback segment size in pages
+ purge_del_mark_records	purge	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of delete-marked rows purged
+ purge_upd_exist_or_extern_records	purge	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of purges on updates of existing records and updates on delete marked record with externally stored field
+ purge_invoked	purge	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of times purge was invoked
+ purge_undo_log_pages	purge	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of undo log pages handled by the purge
+ purge_dml_delay_usec	purge	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Microseconds DML to be delayed due to purge lagging
+ purge_stop_count	purge	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Number of times purge was stopped
+ purge_resume_count	purge	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Number of times purge was resumed
+ log_checkpoints	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of checkpoints
+ log_lsn_last_flush	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	LSN of Last flush
+ log_lsn_last_checkpoint	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	LSN at last checkpoint
+ log_lsn_current	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Current LSN value
+ log_lsn_checkpoint_age	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Current LSN value minus LSN at last checkpoint
+ log_lsn_buf_pool_oldest	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	The oldest modified block LSN in the buffer pool
+ log_max_modified_age_async	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Maximum LSN difference; when exceeded, start asynchronous preflush
+ log_max_modified_age_sync	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Maximum LSN difference; when exceeded, start synchronous preflush
+ log_pending_log_flushes	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Pending log flushes
+ log_pending_checkpoint_writes	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Pending checkpoints
+ log_num_log_io	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Number of log I/Os
+ log_waits	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of log waits due to small log buffer (innodb_log_waits)
+ log_write_requests	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of log write requests (innodb_log_write_requests)
+ log_writes	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of log writes (innodb_log_writes)
+ log_padded	recovery	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Bytes of log padded for log write ahead
+ compress_pages_compressed	compression	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of pages compressed
+ compress_pages_decompressed	compression	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of pages decompressed
+ compression_pad_increments	compression	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of times padding is incremented to avoid compression failures
+ compression_pad_decrements	compression	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of times padding is decremented due to good compressibility
+ compress_saved	compression	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of bytes saved by page compression
+ compress_pages_page_compressed	compression	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of pages compressed by page compression
+ compress_page_compressed_trim_op	compression	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of TRIM operation performed by page compression
+ compress_pages_page_decompressed	compression	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of pages decompressed by page compression
+ compress_pages_page_compression_error	compression	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of page compression errors
+ compress_pages_encrypted	compression	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of pages encrypted
+ compress_pages_decrypted	compression	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of pages decrypted
+ index_page_splits	index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of index page splits
+ index_page_merge_attempts	index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of index page merge attempts
+ index_page_merge_successful	index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of successful index page merges
+ index_page_reorg_attempts	index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of index page reorganization attempts
+ index_page_reorg_successful	index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of successful index page reorganizations
+ index_page_discards	index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of index pages discarded
+ adaptive_hash_searches	adaptive_hash_index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of successful searches using Adaptive Hash Index
+ adaptive_hash_searches_btree	adaptive_hash_index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of searches using B-tree on an index search
+ adaptive_hash_pages_added	adaptive_hash_index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of index pages on which the Adaptive Hash Index is built
+ adaptive_hash_pages_removed	adaptive_hash_index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of index pages whose corresponding Adaptive Hash Index entries were removed
+ adaptive_hash_rows_added	adaptive_hash_index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Adaptive Hash Index rows added
+ adaptive_hash_rows_removed	adaptive_hash_index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Adaptive Hash Index rows removed
+ adaptive_hash_rows_deleted_no_hash_entry	adaptive_hash_index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of rows deleted that did not have corresponding Adaptive Hash Index entries
+ adaptive_hash_rows_updated	adaptive_hash_index	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of Adaptive Hash Index rows updated
+ file_num_open_files	file_system	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	Number of files currently open (innodb_num_open_files)
+ ibuf_merges_insert	change_buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of inserted records merged by change buffering
+ ibuf_merges_delete_mark	change_buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of deleted records merged by change buffering
+ ibuf_merges_delete	change_buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of purge records merged by change buffering
+ ibuf_merges_discard_insert	change_buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of insert merged operations discarded
+ ibuf_merges_discard_delete_mark	change_buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of deleted merged operations discarded
+ ibuf_merges_discard_delete	change_buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of purge merged  operations discarded
+ ibuf_merges	change_buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of change buffer merges
+ ibuf_size	change_buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Change buffer size in pages
+ innodb_master_thread_sleeps	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of times (seconds) master thread sleeps
+ innodb_activity_count	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Current server activity count
+ innodb_master_active_loops	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of times master thread performs its tasks when server is active
+ innodb_master_idle_loops	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of times master thread performs its tasks when server is idle
+ innodb_background_drop_table_usec	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Time (in microseconds) spent to process drop table list
+ innodb_ibuf_merge_usec	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Time (in microseconds) spent to process change buffer merge
+ innodb_log_flush_usec	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Time (in microseconds) spent to flush log records
+ innodb_mem_validate_usec	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Time (in microseconds) spent to do memory validation
+ innodb_master_purge_usec	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Time (in microseconds) spent by master thread to purge records
+ innodb_dict_lru_usec	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Time (in microseconds) spent to process DICT LRU list
+ innodb_dict_lru_count_active	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of tables evicted from DICT LRU list in the active loop
+ innodb_dict_lru_count_idle	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of tables evicted from DICT LRU list in the idle loop
+ innodb_checkpoint_usec	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Time (in microseconds) spent by master thread to do checkpoint
+ innodb_dblwr_writes	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of doublewrite operations that have been performed (innodb_dblwr_writes)
+ innodb_dblwr_pages_written	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of pages that have been written for doublewrite operations (innodb_dblwr_pages_written)
+ innodb_page_size	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	value	InnoDB page size in bytes (innodb_page_size)
+ innodb_rwlock_s_spin_waits	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of rwlock spin waits due to shared latch request
+ innodb_rwlock_x_spin_waits	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of rwlock spin waits due to exclusive latch request
+ innodb_rwlock_sx_spin_waits	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of rwlock spin waits due to sx latch request
+ innodb_rwlock_s_spin_rounds	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of rwlock spin loop rounds due to shared latch request
+ innodb_rwlock_x_spin_rounds	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of rwlock spin loop rounds due to exclusive latch request
+ innodb_rwlock_sx_spin_rounds	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of rwlock spin loop rounds due to sx latch request
+ innodb_rwlock_s_os_waits	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of OS waits due to shared latch request
+ innodb_rwlock_x_os_waits	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of OS waits due to exclusive latch request
+ innodb_rwlock_sx_os_waits	server	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of OS waits due to sx latch request
+ dml_reads	dml	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of rows read
+ dml_inserts	dml	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of rows inserted
+ dml_deletes	dml	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of rows deleted
+ dml_updates	dml	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of rows updated
+ dml_system_reads	dml	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of system rows read
+ dml_system_inserts	dml	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of system rows inserted
+ dml_system_deletes	dml	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of system rows deleted
+ dml_system_updates	dml	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	status_counter	Number of system rows updated
+ ddl_background_drop_indexes	ddl	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of indexes waiting to be dropped after failed index creation
+ ddl_background_drop_tables	ddl	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of tables in background drop table list
+ ddl_online_create_index	ddl	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of indexes being created online
+ ddl_pending_alter_table	ddl	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of ALTER TABLE, CREATE INDEX, DROP INDEX in progress
+ ddl_sort_file_alter_table	ddl	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of sort files created during alter table
+ ddl_log_file_alter_table	ddl	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of log files created during alter table
+ icp_attempts	icp	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of attempts for index push-down condition checks
+ icp_no_match	icp	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Index push-down condition does not match
+ icp_out_of_range	icp	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Index push-down condition out of range
+ icp_match	icp	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Index push-down condition matches
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD;
+ value
+ a
+ about
+ an
+ are
+ as
+ at
+ be
+ by
+ com
+ de
+ en
+ for
+ from
+ how
+ i
+ in
+ is
+ it
+ la
+ of
+ on
+ or
+ that
+ the
+ this
+ to
+ was
+ what
+ when
+ where
+ who
+ will
+ with
+ und
+ the
+ www
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
+ DOC_ID
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED;
+ DOC_ID
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
+ WORD	FIRST_DOC_ID	LAST_DOC_ID	DOC_COUNT	DOC_ID	POSITION
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
+ WORD	FIRST_DOC_ID	LAST_DOC_ID	DOC_COUNT	DOC_ID	POSITION
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG;
+ KEY	VALUE
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
+ POOL_ID	POOL_SIZE	FREE_BUFFERS	DATABASE_PAGES	OLD_DATABASE_PAGES	MODIFIED_DATABASE_PAGES	PENDING_DECOMPRESS	PENDING_READS	PENDING_FLUSH_LRU	PENDING_FLUSH_LIST	PAGES_MADE_YOUNG	PAGES_NOT_MADE_YOUNG	PAGES_MADE_YOUNG_RATE	PAGES_MADE_NOT_YOUNG_RATE	NUMBER_PAGES_READ	NUMBER_PAGES_CREATED	NUMBER_PAGES_WRITTEN	PAGES_READ_RATE	PAGES_CREATE_RATE	PAGES_WRITTEN_RATE	NUMBER_PAGES_GET	HIT_RATE	YOUNG_MAKE_PER_THOUSAND_GETS	NOT_YOUNG_MAKE_PER_THOUSAND_GETS	NUMBER_PAGES_READ_AHEAD	NUMBER_READ_AHEAD_EVICTED	READ_AHEAD_RATE	READ_AHEAD_EVICTED_RATE	LRU_IO_TOTAL	LRU_IO_CURRENT	UNCOMPRESS_TOTAL	UNCOMPRESS_CURRENT
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
+ POOL_ID	BLOCK_ID	SPACE	PAGE_NUMBER	PAGE_TYPE	FLUSH_TYPE	FIX_COUNT	IS_HASHED	NEWEST_MODIFICATION	OLDEST_MODIFICATION	ACCESS_TIME	TABLE_NAME	INDEX_NAME	NUMBER_RECORDS	DATA_SIZE	COMPRESSED_SIZE	PAGE_STATE	IO_FIX	IS_OLD	FREE_PAGE_CLOCK
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
+ POOL_ID	LRU_POSITION	SPACE	PAGE_NUMBER	PAGE_TYPE	FLUSH_TYPE	FIX_COUNT	IS_HASHED	NEWEST_MODIFICATION	OLDEST_MODIFICATION	ACCESS_TIME	TABLE_NAME	INDEX_NAME	NUMBER_RECORDS	DATA_SIZE	COMPRESSED_SIZE	COMPRESSED	IO_FIX	IS_OLD	FREE_PAGE_CLOCK
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
+ TABLE_ID	NAME	FLAG	N_COLS	SPACE	ROW_FORMAT	ZIP_PAGE_SIZE	SPACE_TYPE
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
+ TABLE_ID	NAME	STATS_INITIALIZED	NUM_ROWS	CLUST_INDEX_SIZE	OTHER_INDEX_SIZE	MODIFIED_COUNTER	AUTOINC	REF_COUNT
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
+ INDEX_ID	NAME	TABLE_ID	TYPE	N_FIELDS	PAGE_NO	SPACE	MERGE_THRESHOLD
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
+ TABLE_ID	NAME	POS	MTYPE	PRTYPE	LEN
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
+ INDEX_ID	NAME	POS
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
+ ID	FOR_NAME	REF_NAME	N_COLS	TYPE
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
+ ID	FOR_COL_NAME	REF_COL_NAME	POS
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES;
+ SPACE	NAME	FLAG	ROW_FORMAT	PAGE_SIZE	ZIP_PAGE_SIZE	SPACE_TYPE	FS_BLOCK_SIZE	FILE_SIZE	ALLOCATED_SIZE
+ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_DATAFILES;
+ SPACE	PATH
diff --cc storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result
index df3ea1d6de6,5f41fd328c9..a639bf6e76c
--- a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result
+++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result
@@@ -680,8 -679,11 +680,10 @@@ DROP TRIGGER tr1
  
  
  ******************** EVENTS ********************
 -GRANT EVENT ON *.* TO 'root'@'localhost';
  INSERT INTO t1 VALUES(1, 'test1');
  CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1;
+ Warnings:
+ Warning	1105	Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
  SHOW EVENTS;
  Db	Name	Definer	Time zone	Type	Execute at	Interval value	Interval field	Starts	Ends	Status	Originator	character_set_client	collation_connection	Database Collation
  test_rpl	e1	root at localhost	SYSTEM	RECURRING	NULL	1	#	#	NULL	ENABLED	1	latin1	latin1_swedish_ci	latin1_swedish_ci
diff --cc strings/strcoll.ic
index 9dfccb9018c,eb5b3d5fe9b..50278135dd4
--- a/strings/strcoll.ic
+++ b/strings/strcoll.ic
@@@ -12,9 -12,10 +12,9 @@@
  
     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1335  USA
  */
  
 -
  #ifndef MY_FUNCTION_NAME
  #error MY_FUNCTION_NAME is not defined
  #endif
diff --cc tests/mysql_client_test.c
index 2c95bac1e21,88e28f79789..40fbffa57bc
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@@ -8397,50 -8397,26 +8397,70 @@@ static void test_list_fields(
  }
  
  
+ /* Test mysql_list_fields() with information_schema */
+ 
+ static void test_list_information_schema_fields()
+ {
+   MYSQL_RES *result;
+   int rc;
+   myheader("test_list_information_schema_fields");
+ 
+   rc= mysql_select_db(mysql, "information_schema");
+   myquery(rc);
+   result= mysql_list_fields(mysql, "all_plugins", NULL);
+   mytest(result);
+   rc= my_process_result_set(result);
+   DIE_UNLESS(rc == 0);
+   mysql_free_result(result);
+   rc= mysql_select_db(mysql, current_db);
+   myquery(rc);
+ }
+ 
+ 
 +static void test_list_fields_blob()
 +{
 +  MYSQL_RES *result;
 +  int rc;
 +  myheader("test_list_fields_blob");
 +
 +  rc= mysql_query(mysql, "drop table if exists t1");
 +  myquery(rc);
 +
 +  rc= mysql_query(mysql, "create table t1(c1 tinyblob, c2 blob, c3 mediumblob, c4 longblob)");
 +  myquery(rc);
 +
 +  result= mysql_list_fields(mysql, "t1", NULL);
 +  mytest(result);
 +
 +  rc= my_process_result_set(result);
 +  DIE_UNLESS(rc == 0);
 +
 +  /*
 +    All BLOB variant Fields are displayed as MYSQL_TYPE_BLOB in
 +    the result set metadata. Note, some Items display the exact
 +    BLOB type. This inconsistency should be fixed eventually.
 +  */
 +  verify_prepare_field(result, 0, "c1", "c1", MYSQL_TYPE_BLOB,
 +                       "t1", "t1",
 +                       current_db, 255, NULL);
 +
 +  verify_prepare_field(result, 1, "c2", "c2", MYSQL_TYPE_BLOB,
 +                       "t1", "t1",
 +                       current_db, 65535, NULL);
 +
 +  verify_prepare_field(result, 2, "c3", "c3", MYSQL_TYPE_BLOB,
 +                       "t1", "t1",
 +                       current_db, 16777215, NULL);
 +
 +  verify_prepare_field(result, 3, "c4", "c4", MYSQL_TYPE_BLOB,
 +                       "t1", "t1",
 +                       current_db, 4294967295ULL, NULL);
 +
 +  mysql_free_result(result);
 +  myquery(mysql_query(mysql, "drop table t1"));
 +}
 +
 +
  static void test_list_fields_default()
  {
    int rc, i;
@@@ -20946,7 -20885,7 +20966,8 @@@ static struct my_tests_st my_tests[]= 
    { "test_fetch_column", test_fetch_column },
    { "test_mem_overun", test_mem_overun },
    { "test_list_fields", test_list_fields },
+   { "test_list_information_schema_fields", test_list_information_schema_fields },
 +  { "test_list_fields_blob", test_list_fields_blob },
    { "test_list_fields_default", test_list_fields_default },
    { "test_free_result", test_free_result },
    { "test_free_store_result", test_free_store_result },


More information about the commits mailing list