diff --git a/.bzrignore b/.bzrignore index 09d0ffdffe4..7cc06b8bc13 100644 --- a/.bzrignore +++ b/.bzrignore @@ -10,11 +10,14 @@ *.core *.d *.da +*.dll *.exe +*.exp *.gcda *.gcno *.gcov *.idb +*.ilk *.la *.lai *.lib @@ -59,6 +62,7 @@ ./mysql.sln ./mysql.suo ./prepare +.DS_Store .defs.mk .depend .depend.mk @@ -459,6 +463,7 @@ cmd-line-utils/readline/.deps/undo.Po cmd-line-utils/readline/.deps/util.Po cmd-line-utils/readline/.deps/vi_mode.Po cmd-line-utils/readline/.deps/xmalloc.Po +comments comon.h comp_err/*.ds? comp_err/*.vcproj @@ -494,6 +499,7 @@ dbug/factorial dbug/factorial.r dbug/main.r dbug/output*.r +dbug/tests dbug/user.ps dbug/user.t debian/control @@ -1180,6 +1186,7 @@ libmysqld/sql_parse.cc libmysqld/sql_partition.cc libmysqld/sql_plugin.cc libmysqld/sql_prepare.cc +libmysqld/sql_profile.cc libmysqld/sql_rename.cc libmysqld/sql_repl.cc libmysqld/sql_select.cc @@ -1221,7 +1228,10 @@ linked_server_sources linked_tools_sources locked ltmain.sh +ma_test_recovery.output man/*.1 +maria-win.patch +maria_log.00000* maria_log_control merge/*.ds? merge/*.vcproj @@ -1282,6 +1292,9 @@ mysql-5.0.2-alpha.tar.gz mysql-max-4.0.2-alpha-pc-linux-gnu-i686.tar.gz mysql-test/*.ds? mysql-test/*.vcproj +mysql-test/.DS_Store +mysql-test/funcs_1.log +mysql-test/funcs_1.tar mysql-test/gmon.out mysql-test/install_test_db mysql-test/lib/init_db.sql @@ -1370,9 +1383,12 @@ mysql-test/r/symlink.log mysql-test/r/system_mysql_db.log mysql-test/r/tmp.result mysql-test/r/udf.log +mysql-test/reg.log mysql-test/rpl.log mysql-test/share/mysql mysql-test/std_data/*.pem +mysql-test/suite/funcs_1.tar.gz +mysql-test/suite/funcs_1.tar.zip mysql-test/suite/funcs_1/r/innodb_trig_03e.warnings mysql-test/suite/funcs_1/r/innodb_views.warnings mysql-test/suite/funcs_1/r/memory_trig_03e.warnings @@ -2443,6 +2459,7 @@ storage/maria/ma_test_all storage/maria/maria.log storage/maria/maria_chk storage/maria/maria_control +storage/maria/maria_dump_log storage/maria/maria_ftdump storage/maria/maria_log storage/maria/maria_log.* @@ -2471,6 +2488,7 @@ storage/maria/unittest/mf_pagecache_consist_64kWR-t-big storage/maria/unittest/mf_pagecache_single_64k-t-big storage/maria/unittest/page_cache_test_file_1 storage/maria/unittest/pagecache_debug.log +storage/maria/unittest/tmp/* storage/myisam/.deps/ft_boolean_search.Po storage/myisam/.deps/ft_nlq_search.Po storage/myisam/.deps/ft_parser.Po @@ -2992,6 +3010,7 @@ test/tools/ndb_cpcc test/tools/restart test/tools/verify_index test1/* +test?.MA? test_xml tests/*.ds? tests/*.vcproj @@ -3042,6 +3061,7 @@ unittest/mytap/t/*.t unittest/mytap/t/.deps/basic-t.Po unittest/page_cache_test_file_1 unittest/pagecache_debug.log +unittest/tmp/* unittest/unit vi.h vio/*.ds? @@ -3066,16 +3086,3 @@ win/vs8cache.txt ylwrap zlib/*.ds? zlib/*.vcproj -libmysqld/sql_profile.cc -*.dll -*.ilk -*.exp -comments -maria-win.patch -storage/maria/maria_dump_log -maria_log.00000* -ma_test_recovery.output -test?.MA? -dbug/tests -storage/maria/unittest/tmp/* -unittest/tmp/* diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index 30ab41a7a8e..638fc98a508 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -100,8 +100,10 @@ if [ "x$warning_mode" != "xpedantic" ]; then # C warnings c_warnings="$warnings -Wunused-parameter" # C++ warnings - cxx_warnings="$warnings -Woverloaded-virtual -Wsign-promo -Wreorder" - cxx_warnings="$warnings -Wctor-dtor-privacy -Wnon-virtual-dtor" + cxx_warnings="$warnings" +# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo" + cxx_warnings="$cxx_warnings -Wreorder" + cxx_warnings="$cxx_warnings -Wctor-dtor-privacy -Wnon-virtual-dtor" # Added unless --with-debug=full debug_extra_cflags="-O1 -Wuninitialized" else diff --git a/BUILD/build_mccge.sh b/BUILD/build_mccge.sh new file mode 100755 index 00000000000..fc0f8181692 --- /dev/null +++ b/BUILD/build_mccge.sh @@ -0,0 +1,1516 @@ +#!/bin/sh + +die() +{ + echo "ERROR: $@"; exit 1; +} + +get_key_value() +{ + echo "$1" | sed 's/^--[a-zA-Z_-]*=//' +} + +developer_usage() +{ +cat < ./build_mccge.sh + + This performs the following operations: + 1) Detects the operating system. Currently, Linux, FreeBSD, Solaris + 10/11, and Mac OS X are supported by this script. + 2) Detect the type of CPU being used. Currently supported processors + are: x86 for all supported operating systems, Itanium for Linux + with GCC, and SPARC for Solaris using the Forte compiler. + 3) Invokes the GCC compiler. + 4) Builds a set of MySQL Cluster Carrier Grade Edition binaries; for + more information about these, see --extended-help. + + The default version assumes that you have a source code tarball from + which you are building, and thus autoconf and automake do not need to + be run. If you have downloaded a BitKeeper tree then you should read + --developer-help. + + If you are building MySQL Cluster Carrier Grade Edition for commercial + use then you need to set the --commercial flag to ensure that the + commercial libraries are compiled in, rather than the GPL-only + libraries. The default is to build a GPL version of MySQL Cluster + Carrier Grade Edition. + + If your building on a Solaris SPARC machine you must set + --compiler=forte; if you want to build using the Intel compiler on + Linux, you need to set --compiler=icc. + + If you want to make sure that a 64-bit version is built then you + should add the flag --64. This is always set on Solaris machines and + when check-cpu is able to discover that a 64-bit CPU is being used. If + you want to ensure that a 32-bit binary is produced, use --32 instead. + + If you need the binaries to be installed in a different location from + /usr/local/mysql, then you should set --prefix to point to where you + want the binaries installed. + + Using a data directory other than the default (PREFIX/data) can be + done when starting the MySQL Server, or by invoking this script with + the --datadir option. + + If you want your binaries stripped of surplus debug or other + information, use the --strip option. + + If you want debug information in the binary (for example, to be + able to send gdb core dumps to MySQL Support), then you should add the + flag --with-debug; if you want a production build with only debugging + information in the binary then use --debug. + + If your aim is not to build MySQL Cluster Carrier Grade Edition, you + can also use this script to build MySQL Classic and MySQL Pro + versions; see the --extended-help for descriptions of these packages. +EOF +} + +usage() +{ +cat < 32-bit binary + x86_64 => 64 bit binary unless Mac OS X + --warning-mode=[extra|pedantic|normal|no] Set warning mode level + --warnings Set warning mode to normal + --32 Build a 32-bit binary even if CPU is 64-bit + --64 Build a 64-bit binary even if not sure a + 64-bit CPU is being used + --package=[cge|extended|pro|classic] Select package to build + --parallelism=number Define parallelism in make + --strip Strip binaries + --error-inject Enable error injection into MySQL Server and + data nodes + --valgrind Build with valgrind + --fast Optimise for CPU architecture buildt on + --static-linking Statically link system libraries into binaries + --with-flags * Pass extra --with-xxx options to configure +EOF + if test "x$1" != "x" ; then + echo "Failure Message: $1" + fi +} + +extended_usage() +{ + cat </bin (can be overridden) + + --localstatedir: /data, unless --datadir is used, in which + case it defaults to /data (can be overridden by setting + --localstatedir explicitly). + + --enable-local-infile: Enable use of the LOAD DATA FROM LOCAL INFILE + command (cannot be overridden). + + --enable-thread-safe-client: Enable the multi-threaded mysql client + library (cannot be overridden). + + --with-big-tables: Enable use of tables with more than 4G rows (cannot + be overridden). + + --with-extra-charsets=all: Enable use of all character sets supported + by MySQL (cannot be overridden). + + --with-ssl: Enable use of yaSSL library included in the MySQL source + (cannot be overridden). + + --with-pic: Build all binaries using position independent assembler + to avoid problems with dynamic linkers (cannot be overridden). + + --with-csv-storage-engine: Ensure that the CSV storage engine is + included in all builds. Since CSV is required for log tables in + MySQL 5.1, this option cannot be overridden. + + (Note that MyISAM support is always built into the MySQL Server; the + server *cannot* be built without MyISAM.) + + --with-mysqld-ldflags=-static + --with-client-ldflags=-static + Ensures that binaries for, respectively, the MySQL server and client + are built with static libraries except for the system libraries, + which use dynamically loaded libraries provided by the operating + system. Building with --developer sets these to all-static instead, + to build everything statically. + + In addition there are some configure options that are specific to + Linux operating systems: + + --with-fast-mutexes + Include an alternative implementation of mutexes that is faster on + Linux systems + + --enable-assembler + Include assembler code optimisations for a number of mostly string + methods. Used for x86 processors only. + + Neither of the preceding options can be disabled. + + MySQL Cluster Carrier Grade edition also adds the following options + (also used by the extended package): + + --with-ndbcluster + Include the NDB Cluster storage engine, its kernel, management + server, and client, as well as support for the NDB and MGM APIs. + + --without-ndb-debug + Do not include specific NDB debug code, not even in debug versions + (cannot be overridden). + + Package-specific options: + ------------------------- + --with-innodb + Specifically included in the "pro" and "extended" packages, and not + in any of the others. + + --with-comment + Sets the comment for the MySQL version, by package, as described + above. + + --with-server-suffix + Sets the server suffix on the MySQL version, by package, as + described above. + + Other options used: + ------------------- + --with-readline + Use the GPL readline library for command editing functions; not + available with commercial packages. + + --with-libedit + Use the BSD licensed library for command editing functions; used for + commercial packages. + + --with-zlib-dir=bundled + Use the zlib package bundled with MySQL. + + --with-mysqld-libs=-lmtmalloc + Used on Solaris to ensure that the proper malloc library is used. + + Compiler options: + ----------------- + + This section describes the compiler options for each of the different + platforms supported by thisscript. + + The --fast option adds -mtune=cpu_arg to the C/C++ flags (provides + support for Nocona, K8, and other processors). + + Use of the --debug option adds -g to the C/C++ flags. + + FreeBSD/x86/gcc + --------------- + No flags are used. Instead, configure determines the proper flags to + use. + + Linux/x86+Itanium/gcc + ------------- + No flags are used. Instead the configure script determines the + proper flags to use for both normal and debug builds. Discovery of a + Nocona or Core 2 Duo CPU causes a 64-bit binary to be built; + otherwise, the binary is 32-bit. To build a 64-bit binary, -m64 is + added to the C/C++ flags. (To build a 32-bit binary on a 64-bit CPU, + use the --32 option as described previously.) + + Linux/x86+Itanium/icc + ------------- + Flags used: + CC = icc -static-libgcc -static-libcxa -i-static + C++ = icpc -static-libgcc -static-libcxa -i-static + C/C++ flags = -mp -restrict + + On Itanium we also add -no-ftz and -no-prefetch to CC and C++ flags. + + The non-debug versions also add the following: + C/C++ flags += -O3 unroll2 -ip + + The fast version adds: + C/C++ flags += -ipo + + On discovery of a Core 2 Duo architecture while using icc, -xT is also + added to the C/C++ flags; this provides optimisations specific to Core + 2 Duo. This is added only when the --fast flag is set. + + Solaris/x86/gcc + --------------- + All builds on Solaris are 64-bit, so -m64 is always used in the + C/C++ flags. LDFLAGS is set to -m64 -static-libgcc -O/-O2. + + Solaris/Sparc/Forte + ------------------- + Uses cc-5.0 as CC + Sets ASFLAGS=LDFLAGS=xarch=v9, so that we compile Sparc v9 binaries + C flags = -Xa -strconst -xc99=none + C++ flags = -noex + C/C++ flags = -mt -D_FORTEC -xarch=v9 + + For non-debug builds, the following flags are also used: + + C/C++ flags = -xO3 + + MacOSX/x86/gcc + -------------- + C/C++ flags include -fno-common -arch i386. + + Non-debug versions also add -Os -felide-constructors, where "-Os" + means the build is space-optimised as long as the space optimisations + do not negatively affect performance. Debug versions use -O. +EOF +} +with_usage() +{ + cat < /dev/null 2>&1 + then + make=gmake + else + make=make + fi + if test "x`$make --version | grep GNU`" = "x" ; then + die "Only gmake is supported" + fi +} + +# +# Find a libtoolize binary, both libtoolize and glibtoolize are +# ok, use first found. +# +set_libtoolize_version() +{ + LIBTOOLIZE=not_found + save_ifs="$IFS"; IFS=':' + for dir in $PATH + do + if test -x $dir/libtoolize + then + LIBTOOLIZE=libtoolize + echo "Found libtoolize in $dir" + break + fi + if test -x $dir/glibtoolize + then + LIBTOOLIZE=glibtoolize + echo "Found glibtoolize in $dir" + break + fi + done + IFS="$save_ifs" + if test "x$LIBTOOLIZE" = "xnot_found" ; then + die "Found no libtoolize version, quitting here" + fi + return +} + +# +# If ccache (a compiler cache which reduces build time) +# (http://samba.org/ccache) is installed, use it. +# We use 'grep' and hope that 'grep' works as expected +# (returns 0 if finds lines) +# We do not use ccache when gcov is used. Also only when +# gcc is used. +# +set_up_ccache() +{ + if test "x$compiler" = "xgcc" ; then + if ccache -V > /dev/null 2>&1 && test "$USING_GCOV" != "1" + then + echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC" + echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX" + fi + fi +} + +# +# Set flags for various build configurations. +# Used in -valgrind builds +# +set_valgrind_flags() +{ + if test "x$valgrind_flag" = "xyes" ; then + loc_valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify " + loc_valgrind_flags="$loc_valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max" + compiler_flags="$compiler_flags $loc_valgrind_flags" + fi +} + +# +# Set up warnings; default is to use no warnings, but if warning_mode +# is used a lot of warning flags are set up. These flags are valid only +# for gcc, so for other compilers we ignore the warning_mode. +# +set_warning_flags() +{ + if test "x$developer_flag" = "xyes" && test "x$warning_mode" = "x" ; then + warning_mode="normal" + fi + if test "x$compiler" = "xgcc" ; then + if test "x$warning_mode" = "normal" || test "x$warning_mode" = "extra" ; then +# Both C and C++ warnings + warnings="$warnings -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs" + warnings="$warnings -Wcomment -W" + warnings="$warnings -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare" + warnings="$warnings -Wwrite-strings -Wunused-function -Wunused-label" + warnings="$warnings -Wunused-value -Wunused-variable" + + if test "x$warning_mode" = "extra" ; then + warnings="$warnings -Wshadow" + fi +# C warnings + c_warnings="$warnings -Wunused-parameter" +# C++ warnings + cxx_warnings="$warnings -Woverloaded-virtual -Wsign-promo -Wreorder" + cxx_warnings="$warnings -Wctor-dtor-privacy -Wnon-virtual-dtor" +# Added unless --with-debug=full + if test "x$full_debug" = "x" ; then + compiler_flags="$compiler_flags -Wuninitialized" + fi + elif test "x$warning_mode" = "xpedantic" ; then + warnings="-W -Wall -ansi -pedantic -Wno-long-long -D_POSIX_SOURCE" + c_warnings="$warnings" + cxx_warnings="$warnings -std=c++98" +# Reset CPU flags (-mtune), they don't work in -pedantic mode + check_cpu_cflags="" + fi + fi +} + +# +# Used in -debug builds +# +set_with_debug_flags() +{ + if test "x$with_debug_flag" = "xyes" ; then + if test "x$developer_flag" = "xyes" ; then + loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS " + loc_debug_flags="$loc_debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC" + compiler_flags="$compiler_flags $loc_debug_flags" + fi + fi +} + +# +# Flag for optimizing builds for developers. +# +set_no_omit_frame_pointer_for_developers() +{ + if test "x$fast_flag" != "xno" ; then + if test "x$developer_flag" = "xyes" && test "x$compiler" = "xgcc" ; then +# Be as fast as we can be without losing our ability to backtrace. + compiler_flags="$compiler_flags -fno-omit-frame-pointer" + fi + fi +} + +# +# Add -g to all builds that requested debug information in build +# +set_debug_flag() +{ + if test "x$compile_debug_flags" = "xyes" ; then + compiler_flags="$compiler_flags -g" + fi +} + +# +# Base options used by all packages +# +# SSL library to use. --with-ssl selects the bundled yaSSL +# implementation of SSL. To use openSSL, you must point out the location +# of the openSSL headers and libs on your system. +# For example: --with-ssl=/usr +# +set_base_configs() +{ + base_configs="$base_configs --prefix=$prefix" + base_configs="$base_configs --libexecdir=$prefix/bin" + base_configs="$base_configs --with-zlib-dir=bundled" + if test "x$datadir" = "x" ; then + base_configs="$base_configs --localstatedir=$prefix/data" + else + base_configs="$base_configs --localstatedir=$datadir" + fi + if test "x$with_debug_flag" = "xyes" ; then + base_configs="$base_configs --with-debug$full_debug" + fi + base_configs="$base_configs --enable-local-infile" + base_configs="$base_configs --enable-thread-safe-client" + base_configs="$base_configs --with-big-tables" + base_configs="$base_configs --with-extra-charsets=all" + base_configs="$base_configs --with-ssl" + base_configs="$base_configs --with-pic" + base_configs="$base_configs --with-csv-storage-engine" +} + +# +# Add all standard engines and partitioning (included as part of MySQL +# Cluster storage engine as well) as part of MySQL Server. These are +# added in all packages except the classic package. +# +set_base_engines() +{ + engine_configs="$engine_configs --with-archive-storage-engine" + engine_configs="$engine_configs --with-blackhole-storage-engine" + engine_configs="$engine_configs --with-example-storage-engine" + engine_configs="$engine_configs --with-federated-storage-engine" + engine_configs="$engine_configs --with-partition" +} + +set_pro_package() +{ + base_configs="$base_configs $engine_configs" + base_configs="$base_configs --with-innodb" + base_configs="$base_configs --with-comment=\"MySQL Pro $version_text built from source\"" + if test "x$with_debug_flag" = "xyes" ; then + base_configs="$base_configs --with-server-suffix=\"-debug\"" + fi +} + +set_cge_extended_package() +{ + if test "x$gpl" = "xno" ; then + echo "Cannot build Extended Carrier Grade Edition as Commercial version" + fi + base_configs="$base_configs --with-ndbcluster" + base_configs="$base_configs --without-ndb-debug" + base_configs="$base_configs $engine_configs" + base_configs="$base_configs --with-innodb" + base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Extended Edition $version_text built from source\"" + if test "x$with_debug_flag" = "xyes" ; then + base_configs="$base_configs --with-server-suffix=\"-cge-extended-debug\"" + else + base_configs="$base_configs --with-server-suffix=\"-cge-extended"\" + fi +} + +set_cge_package() +{ + base_configs="$base_configs --with-ndbcluster" + base_configs="$base_configs --without-ndb-debug" + base_configs="$base_configs $engine_configs" + base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Edition $version_text built from source\"" + if test "x$with_debug_flag" = "xyes" ; then + base_configs="$base_configs --with-server-suffix=\"-cge-debug\"" + else + base_configs="$base_configs --with-server-suffix=\"-cge"\" + fi +} + +set_classic_package() +{ + base_configs="$base_configs --with-comment=\"MySQL Classic $version_text built from source\"" + if test "x$with_debug_flag" = "xyes" ; then + base_configs="$base_configs --with-server-suffix=\"-debug\"" + fi +} + +# +# Special handling of readline; use readline from the MySQL +# distribution if building a GPL version, otherwise use libedit. +# +set_readline_package() +{ + if test -d "$path/../cmd-line-utils/readline" && test "x$gpl" = "xyes" ; then + base_configs="$base_configs --with-readline" + elif test -d "$path/../cmd-line-utils/libedit" ; then + base_configs="$base_configs --with-libedit" + fi +} + +# +# If fast flag set by user we also add architecture as discovered to +# compiler flags to make binary optimised for architecture at hand. +# We use this feature on gcc compilers. +# +set_gcc_special_options() +{ + if test "x$fast_flag" = "xyes" && test "x$compiler" = "xgcc" ; then + compiler_flags="$compiler_flags $check_cpu_cflags" + fi +} + +# +# If we discover a Core 2 Duo architecture and we have enabled the fast +# flag, we enable a compile especially optimised for Core 2 Duo. This +# feature is currently available on Intel's icc compiler only. +# +set_icc_special_options() +{ + if test "x$fast_flag" = "xyes" && test "x$cpu_arg" = "xcore2" && \ + test "x$compiler" = "xicc" ; then + compiler_flags="$compiler_flags -xT" + fi +} + +# +# FreeBSD Section +# +set_bsd_configs() +{ + if test "x$cpu_base_type" != "xx86" ; then + usage "Only x86 CPUs supported for FreeBSD" + exit 1 + fi + if test "x$compiler" != "xgcc" ; then + usage "Only gcc supported for FreeBSD" + exit 1 + fi + base_configs="$base_configs --enable-assembler" + CC="gcc" + CXX="gcc" +} + +# +# Linux Section +# +set_linux_configs() +{ + if test "x$cpu_base_type" != "xx86" && \ + test "x$cpu_base_type" != "xitanium" ; then + usage "Only x86 and Itanium CPUs supported for 32-bit Linux" + exit 1 + fi + base_configs="$base_configs --with-fast-mutexes" + if test "x$cpu_base_type" = "xx86" ; then + base_configs="$base_configs --enable-assembler" + fi + if test "x$compiler" = "xgcc" ; then + CC="gcc" + CXX="gcc" + if test "x$m64" = "xyes" ; then + compiler_flags="$compiler_flags -m64" + fi +# configure will set proper compiler flags for gcc on Linux + elif test "x$compiler" = "xicc" ; then + compiler_flags="$compiler_flags -mp -restrict" + CC="icc -static-intel" + CXX="icpc -static-intel" + if test "x$cpu_base_type" = "xitanium" ; then + compiler_flags="$compiler_flags -no-ftz" + fi + if test "x$fast_flag" != "xno" ; then + compiler_flags="$compiler_flags -O3 -unroll2 -ip" + if test "x$fast_flag" = "xyes" ; then + compiler_flags="$compiler_flags -ipo" + fi + fi + else + usage "Only gcc and icc compilers supported for Linux" + exit 1 + fi +} + +# +# Solaris Section +# +set_solaris_configs() +{ + base_configs="$base_configs --with-mysqld-libs=-lmtmalloc" + case "`uname -a`" in + *5.10*|*5.11*) + ;; + *) + die "Only versions 10 and 11 supported for Solaris" + esac + if test "x$cpu_base_type" != "xx86" && \ + test "x$cpu_base_type" != "xsparc" ; then + usage "Only x86 and Sparc CPUs supported for Solaris" + exit 1 + fi + if test "x$compiler" = "xgcc" ; then + CC="gcc" + CXX="gcc" + if test "x$cpu_base_type" != "xx86" ; then + usage "Only gcc supported for Solaris 10/11 on SPARC" + fi + compiler_flags="$compiler_flags -m64 -DMY_ATOMIC_MODE_RWLOCKS" + LDFLAGS="-m64 -static-libgcc" + if test "x$fast_flag" != "xno" ; then + LDFLAGS="$LDFLAGS -O2" + compiler_flags="$compiler_flags -O2" + else + LDFLAGS="$LDFLAGS -O" + compiler_flags="$compiler_flags -O" + fi + elif test "x$compiler" = "xforte" ; then + if test "x$cpu_base_type" = "xx86" ; then + usage "Only gcc supported for Solaris/x86" + fi + if test "x$cpu_base_type" != "xsparc" ; then + usage "Forte compiler supported for Solaris 9/SPARC only" + fi + CC="cc-5.0" + CXX=CC + ASFLAGS="xarch=v9" + LDFLAGS="xarch=v9" + base_cflags="$base_cflags -Xa -xstrconst -xc99=none" + base_cxxflags="$base_cxxflags -noex" + compiler_flags="$compiler_flags -mt -D_FORTEC -xarch=v9" + if test "x$fast_flag" != "xno" ; then + compiler_flags="$compiler_flags -xO3" + fi + else + usage "Only gcc and Forte compilers supported for Solaris" + exit 1 + fi +} + +# +# Mac OS X Section +# +set_macosx_configs() +{ + base_cxxflags="$base_cxxflags -fno-common" + if test "x$cpu_base_type" = "xx86" && test "x$compiler" = "xgcc" ; then + compiler_flags="$compiler_flags -arch i386" + else + usage "Only gcc/x86 supported for Mac OS X" + exit 1 + fi +# +# Optimize for space as long as it doesn't affect performance, use some +# optimisations also when not in fast mode. +# + if test "x$fast_flag" != "xno" ; then + compiler_flags="$compiler_flags -Os" + base_cxxflags="$base_cxxflags -felide-constructors" + else + compiler_flags="$compiler_flags -O" + fi + CC="gcc" + CXX="gcc" +} + +# +# Use static linking for own modules and dynamic linking for system +# modules unless specifically requested to do everything statically. +# Should normally not be used; static_linking_flag kept in case someone +# really needs it. Available only if developer flag is also set. +# +set_static_link_configs() +{ + if test "x$static_linking_flag" = "xyes" && test "x$developer_flag" = "xyes" ; then + loc_static_link="--with-mysqld-ldflags=\"-all-static\"" + loc_static_link="$loc_static_link --with-client-ldflags=\"-all-static\"" + else + loc_static_link="--with-mysqld-ldflags=\"-static\"" + loc_static_link="$loc_static_link --with-client-ldflags=\"-static\"" + fi + base_configs="$base_configs $loc_static_link" +} + +# +# Enable error injection in MySQL Server (for developer build only - +# extra check for developer flag required). +# +set_error_inject_configs() +{ + if test "x$error_inject_flag" = "xyes" && test "x$developer_flag" = "xyes" ; then + base_configs="$base_configs --with-error-inject" + if test "x$package" = "xndb" || test "x$package" = "xextended" ; then + base_configs="$base_configs --with-ndb-ccflags='-DERROR_INSERT'" + fi + fi +} + +set_default_package() +{ + if test "x$package" = "x" ; then + if test "x$developer_flag" = "xyes" ; then + package="extended" + else + package="cge" + fi + fi +} + +set_autotool_flags() +{ + if test "x$use_autotools" = "x" ; then + if test "x$developer_flag" = "xno" ; then + use_autotools="no" + else + use_autotools="yes" + fi + fi +} + +set_defaults_based_on_environment() +{ + if test ! -z "$MYSQL_DEVELOPER" ; then + developer_flag="yes" + fi + if test ! -z "$MYSQL_DEVELOPER_DEBUG" ; then + with_debug_flag="yes" + fast_flag="no" + fi + if test ! -z "$MYSQL_DEVELOPER_PACKAGE" ; then + package="$MYSQL_DEVELOPER_PACKAGE" + parse_package + fi +} + +######################################################################## + +if test ! -f sql/mysqld.cc ; then + die "You must run this script from the MySQL top-level directory" +fi + +cpu_type= +package= +prefix="/usr/local/mysql" +parallelism="4" +fast_flag="generic" +compiler="gcc" +gpl="yes" +version_text= +developer_flag="no" +just_configure= +full_debug= +warning_mode= +with_flags= +error_inject_flag= +with_debug_flag= +compile_debug_flag= +strip_flag= +valgrind_flag= +static_linking_flag= +compiler_flags= +os= +cpu_base_type= +warnings= +c_warnings= +cflags= +base_cflags= +cxx_warnings= +base_cxxflags= +base_configs= +debug_flags= +cxxflags= +m32= +m64= +datadir= +commands= +use_autotools= + +set_defaults_based_on_environment + +parse_options "$@" + +set_autotool_flags +set_default_package + +set -e + +# +# Check for the CPU and set up CPU specific flags. We may reset them +# later. +# This call sets the cpu_arg and check_cpu_args parameters +# +path=`dirname $0` +. "$path/check-cpu" +set_cpu_base +if test "x$?" = "x1" ; then + exit 1 +fi + +# +# Set up c_warnings and cxx_warnings; add to compiler_flags. +# Possibly reset check_cpu_flags. +# +set_warning_flags + +# +# Add to compiler_flags. +# +set_valgrind_flags +set_with_debug_flags +set_no_omit_frame_pointer_for_developers +set_debug_flag +set_gcc_special_options +set_icc_special_options + +# +# Definitions of various packages possible to compile. The default is to +# build a source variant of MySQL Cluster Carrier Grade Edition +# including all storage engines except InnoDB, and to use GPL libraries. +# +set_base_configs +set_base_engines +if test "x$gpl" = "xyes" ; then + version_text="GPL version" +else + version_text="Commercial version" +fi +if test "x$package" = "xpro" ; then + set_pro_package +elif test "x$package" = "xextended" ; then + set_cge_extended_package +elif test "x$package" = "xcge" ; then + set_cge_package +elif test "x$package" = "xclassic" ; then + set_classic_package +else + die "No supported package was used, internal error" +fi +set_readline_package +set_static_link_configs +set_error_inject_configs + +# +# This section handles flags for specific combinations of compilers, +# operating systems, and processors. +# + +check_os +if test "x$os" = "xlinux" ; then + set_linux_configs +elif test "x$os" = "xSolaris" ; then + set_solaris_configs +elif test "x$os" = "xMacOSX" ; then + set_macosx_configs +elif test "x$os" = "xbsd" ; then + set_bsd_configs +else + die "Operating system not supported by this script" +fi + +# +# Final step before setting up commands is to set up proper make and +# proper libtoolize versions, and to determine whether to use ccache. +# +set_make_version +set_up_ccache + +# +# Set up commands variable from variables prepared for base +# configurations, compiler flags, and warnings flags. +# +if test "x$use_autotools" = "xyes" ; then + init_auto_commands +fi +init_configure_commands + +if test "x$just_configure" != "xyes" ; then + add_make_commands +fi + +# +# The commands variable now contains the entire command to be run for +# the build; we either execute it, or merely print it out. +# +if test "x$just_print" = "xyes" ; then + echo "$commands" +else + eval "set -x; $commands" +fi diff --git a/BUILD/check-cpu b/BUILD/check-cpu index 0720a53c54d..45dd8404f0d 100755 --- a/BUILD/check-cpu +++ b/BUILD/check-cpu @@ -2,6 +2,9 @@ # # Check cpu of current machine and find the # best compiler optimization flags for gcc +# Will return result in: +# cpu_arg : Type of CPU +# check_cpu_args : Arguments for GCC compiler settings # check_cpu () { @@ -33,7 +36,7 @@ check_cpu () { # parse CPU flags for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //' -e 's/[^a-zA-Z0-9_ ]/_/g'`; do - eval cpu_flag_$flag=yes + eval cpu_flag_$flag=yes done else # Fallback when there is no /proc/cpuinfo @@ -62,92 +65,95 @@ check_cpu () { Alpha*EV6*) cpu_arg="ev6"; ;; - # Intel ia32 *Intel*Core*|*X[eE][oO][nN]*) # a Xeon is just another pentium4 ... # ... unless it has the "lm" (long-mode) flag set, # in that case it's a Xeon with EM64T support + # If SSE3 support exists it is a Core2 Duo or newer # So is Intel Core. - if [ -z "$cpu_flag_lm" ]; then - cpu_arg="pentium4"; - else - cpu_arg="nocona"; + if [ -z "$cpu_flag_lm" ]; then + cpu_arg="pentium4" + else + cpu_arg="nocona" + fi + if test -z "$cpu_flag_ssse3" ; then + core2="no" + else + core2="yes" fi ;; *Pentium*4*Mobile*) - cpu_arg="pentium4m"; - ;; + cpu_arg="pentium4m" + ;; *Pentium*4*) - cpu_arg="pentium4"; + cpu_arg="pentium4" ;; *Pentium*III*Mobile*) - cpu_arg="pentium3m"; - ;; + cpu_arg="pentium3m" + ;; *Pentium*III*) - cpu_arg="pentium3"; - ;; + cpu_arg="pentium3" + ;; *Pentium*M*pro*) - cpu_arg="pentium-m"; + cpu_arg="pentium-m" ;; *Celeron\(R\)*\ M*) - cpu_arg="pentium-m"; - ;; + cpu_arg="pentium-m" + ;; *Celeron*Coppermine*) cpu_arg="pentium3" - ;; + ;; *Celeron\(R\)*) cpu_arg="pentium4" - ;; + ;; *Celeron*) - cpu_arg="pentium2"; - ;; - *Athlon*64*) - cpu_arg="athlon64"; + cpu_arg="pentium2" ;; *Turion*) - cpu_arg="athlon64"; + cpu_arg="athlon64" ;; - *Opteron*) - cpu_arg="athlon64"; + *Athlon*64*) + cpu_arg="athlon64" ;; *Athlon*) - cpu_arg="athlon"; + cpu_arg="athlon" ;; *Opteron*) - cpu_arg="opteron"; + cpu_arg="opteron" ;; # MacOSX / Intel *i386*i486*) - cpu_arg="pentium-m"; + cpu_arg="pentium-m" + ;; + *i386*) + cpu_arg="i386" ;; #Core 2 Duo *Intel*Core\(TM\)2*) - cpu_arg="nocona"; + cpu_arg="nocona" ;; - # Intel ia64 *Itanium*) - # Don't need to set any flags for itanium(at the moment) - cpu_arg=""; + cpu_arg="itanium" ;; - - # + # Solaris Sparc + *sparc*sun4u*) + cpu_arg="sparc" + ;; + # Power PC *ppc*) - cpu_arg='powerpc' + cpu_arg="powerpc" ;; - *powerpc*) - cpu_arg='powerpc' + cpu_arg="powerpc" ;; - # unknown *) - cpu_arg=""; + cpu_arg="" ;; esac - if test -z "$cpu_arg" ; then if test "$CPUINFO" != " " ; then # fallback to uname if necessary @@ -176,29 +182,22 @@ check_cpu () { cc_minor=$2 cc_patch=$3 cc_comp=`expr $cc_major '*' 100 '+' $cc_minor` - + case "$cc_ver--$cc_verno" in *GCC*) # different gcc backends (and versions) have different CPU flags case `gcc -dumpmachine` in - i?86-*) - if test "$cc_comp" -lt 304 - then - check_cpu_args='-mcpu=$cpu_arg' + i?86-* | x86_64-*) + if test "$cc_comp" -lt 304 ; then + check_cpu_cflags="-mcpu=${cpu_arg}" + elif test "$cc_comp" -ge 402 ; then + check_cpu_cflags="-mtune=native" else - check_cpu_args='-mtune=$cpu_arg' + check_cpu_cflags="-mtune=${cpu_arg}" fi ;; ppc-*) - check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg' - ;; - x86_64-*) - if test "$cc_comp" -lt 304 - then - check_cpu_args='-mcpu=$cpu_arg' - else - check_cpu_args='-mtune=$cpu_arg' - fi + check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}" ;; *) check_cpu_cflags="" @@ -208,7 +207,7 @@ check_cpu () { ;; 2.95.*) # GCC 2.95 doesn't expose its name in --version output - check_cpu_args='-m$cpu_arg' + check_cpu_cflags="-m${cpu_arg}" ;; *) check_cpu_cflags="" @@ -219,41 +218,23 @@ check_cpu () { # now we check whether the compiler really understands the cpu type touch __test.c + if test "x$core2" = "xyes" ; then + cpu_arg="core2" + fi while [ "$cpu_arg" ] ; do printf "testing $cpu_arg ... " >&2 # compile check - check_cpu_cflags=`eval echo $check_cpu_args` - if $cc -c $check_cpu_cflags __test.c 2>/dev/null; then - echo ok >&2 - break; + eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null + if test "x$?" = "x0" ; then + echo ok >&2 + break; fi echo failed >&2 check_cpu_cflags="" - - # if compile failed: check whether it supports a predecessor of this CPU - # this list is not complete, feel free to add further entries - case "$cpu_arg" in - # Intel ia32 - nocona) cpu_arg=pentium4 ;; - prescott) cpu_arg=pentium4 ;; - pentium4m) cpu_arg=pentium4 ;; - pentium4) cpu_arg=pentium3 ;; - pentium3m) cpu_arg=pentium3 ;; - pentium3) cpu_arg=pentium2 ;; - pentium2) cpu_arg=pentiumpro ;; - pentiumpro) cpu_arg=pentium ;; - pentium) cpu_arg=i486 ;; - i486) cpu_arg=i386 ;; - - # power / powerPC - 7450) cpu_arg=7400 ;; - - *) cpu_arg="" ;; - esac + break; done - rm __test.* } diff --git a/BitKeeper/triggers/post-commit.innodb.pl b/BitKeeper/triggers/post-commit.innodb.pl new file mode 100755 index 00000000000..44d98b04838 --- /dev/null +++ b/BitKeeper/triggers/post-commit.innodb.pl @@ -0,0 +1,22 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use FindBin; +require "$FindBin::Bin/triggers-lib.pl"; + +# Don't run unless commit was successful +check_status() || exit 0; + +my $cset = latest_cset(); + +# Read most recent ChangeSet's changed files. Send merge changes along, since +# they'll need to be incorporated in InnoDB's source tree eventually. +my $changes = innodb_get_changes('cset', $cset, 'yes') + or exit 0; + +innodb_send_changes_email($cset, $changes) + or exit 1; + +exit 0; diff --git a/BitKeeper/triggers/post-incoming.innodb.pl b/BitKeeper/triggers/post-incoming.innodb.pl new file mode 100755 index 00000000000..4b100d88037 --- /dev/null +++ b/BitKeeper/triggers/post-incoming.innodb.pl @@ -0,0 +1,30 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use FindBin; +require "$FindBin::Bin/triggers-lib.pl"; + +# Don't run unless push/pull was successful +check_status() or exit 0; + +# Don't run if push/pull is in local clones +exit 0 if repository_type() eq 'local'; + +# For each pushed ChangeSet, check it for InnoDB files and send +# diff of entire ChangeSet to InnoDB developers if such changes +# exist. + +my $error = 0; + +foreach my $cset (read_bk_csetlist()) +{ + my $changes = innodb_get_changes('cset', $cset, 'yes') + or next; + + innodb_send_changes_email($cset, $changes) + or $error = 1; +} + +exit ($error == 0 ? 0 : 1); diff --git a/BitKeeper/triggers/pre-commit.innodb.pl b/BitKeeper/triggers/pre-commit.innodb.pl new file mode 100755 index 00000000000..6e2b65113b0 --- /dev/null +++ b/BitKeeper/triggers/pre-commit.innodb.pl @@ -0,0 +1,21 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +use FindBin; +require "$FindBin::Bin/triggers-lib.pl"; + +die "$0: Script error: \$BK_PENDING is not set in pre-commit trigger\n" + unless defined $ENV{BK_PENDING}; + +# Read changed files from $BK_PENDING directly. Do not bother user about +# merge changes; they don't have any choice, the merge must be done. +my $changes = innodb_get_changes('file', $ENV{BK_PENDING}, undef) + or exit 0; + +innodb_inform_and_query_user($changes) + or exit 1; # Abort commit + +# OK, continue with commit +exit 0; diff --git a/BitKeeper/triggers/triggers-lib.pl b/BitKeeper/triggers/triggers-lib.pl new file mode 100644 index 00000000000..65a334ba926 --- /dev/null +++ b/BitKeeper/triggers/triggers-lib.pl @@ -0,0 +1,356 @@ +# To use this convenience library in a trigger, simply require it at +# at the top of the script. For example: +# +# #! /usr/bin/perl +# +# use FindBin; +# require "$FindBin::Bin/triggers-lib.pl"; +# +# FindBin is needed, because sometimes a trigger is called from the +# RESYNC directory, and the trigger dir is ../BitKeeper/triggers + +use strict; +use warnings; + +use Carp; +use FindBin; + + +my $mysql_version = "5.1"; + +# These addresses must be kept current in all MySQL versions. +# See the wiki page InnoDBandOracle. +#my @innodb_to_email = ('dev_innodb_ww@oracle.com'); +#my @innodb_cc_email = ('dev-innodb@mysql.com'); +# FIXME: Keep this for testing; remove it once it's been used for a +# week or two. +my @innodb_to_email = ('tim@mysql.com'); +my @innodb_cc_email = (); + +# This is for MySQL >= 5.1. Regex which defines the InnoDB files +# which should generally not be touched by MySQL developers. +my $innodb_files_description = <> 8)), "\n"; + } + + return $status; +} + + +# check_status +# $warn If true, warn about bad status +# RETURN TRUE, if $BK_STATUS is "OK"; FALSE otherwise +# +# Also checks the undocumented $BK_COMMIT env variable + +sub check_status +{ + my ($warn) = @_; + + my $status = (grep { defined $_ } + $ENV{BK_STATUS}, $ENV{BK_COMMIT}, '')[0]; + + unless ($status eq 'OK') + { + warn "Bad BK_STATUS '$status'\n" if $warn; + return undef; + } + + return 1; +} + + +# repository_location +# +# RETURN ('HOST', 'ROOT') for the repository being modified + +sub repository_location +{ + if ($ENV{BK_SIDE} eq 'client') { + return ($ENV{BK_HOST}, $ENV{BK_ROOT}); + } else { + return ($ENV{BKD_HOST}, $ENV{BKD_ROOT}); + } +} + + +# repository_type +# RETURN: +# 'main' for repo on bk-internal with post-incoming.bugdb trigger +# 'team' for repo on bk-internal with post-incoming.queuepush.pl trigger +# 'local' otherwise +# +# This definition may need to be modified if the host name or triggers change. + +sub repository_type +{ + my ($host, $root) = repository_location(); + + return 'local' + unless uc($host) eq 'BK-INTERNAL.MYSQL.COM' + and -e "$root/BitKeeper/triggers/post-incoming.queuepush.pl"; + + return 'main' if -e "$root/BitKeeper/triggers/post-incoming.bugdb"; + + return 'team'; +} + + +# latest_cset +# RETURN Key for most recent ChangeSet + +sub latest_cset { + chomp(my $retval = `bk changes -r+ -k`); + return $retval; +} + + +# read_bk_csetlist +# RETURN list of cset keys from $BK_CSETLIST file +sub read_bk_csetlist +{ + die "$0: script error: \$BK_CSETLIST not set\n" + unless defined $ENV{BK_CSETLIST}; + + open CSETS, '<', $ENV{BK_CSETLIST} + or die "$0: can't read \$BK_CSETLIST='$ENV{BK_CSETLIST}': $!\n"; + chomp(my @csets = ); + close_or_warn(CSETS, "\$BK_CSETLIST='$ENV{BK_CSETLIST}'"); + + return @csets; +} + + +# innodb_get_changes +# $type 'file' or 'cset' +# $value file name (e.g., $BK_PENDING) or ChangeSet key +# $want_merge_changes flag; if false, merge changes will be ignored +# RETURN A string describing the InnoDB changes, or undef if no changes +# +# The return value does *not* include ChangeSet comments, only per-file +# comments. + +sub innodb_get_changes +{ + my ($type, $value, $want_merge_changes) = @_; + + if ($type eq 'file') + { + open CHANGES, '<', $value + or die "$0: can't read '$value': $!\n"; + } + elsif ($type eq 'cset') + { + open CHANGES, '-|', "bk changes -r'$value' -v -d'$file_rev_dspec'" + or die "$0: can't exec 'bk changes': $!\n"; + } + else + { + croak "$0: script error: invalid type '$type'"; + } + + my @changes = grep { /$innodb_files_regex/ } ; + + close_or_warn(CHANGES, "($type, '$value')"); + + return undef unless @changes; + + + # Set up a pipeline of 'bk log' commands to weed out unwanted deltas. We + # never want deltas which contain no actual changes. We may not want deltas + # which are merges. + + my @filters; + + # This tests if :LI: (lines inserted) or :LD: (lines deleted) is + # non-zero. That is, did this delta change the file contents? + push @filters, + "bk log -d'" + . "\$if(:LI: -gt 0){$file_rev_dspec}" + . "\$if(:LI: -eq 0){\$if(:LD: -gt 0){$file_rev_dspec}}" + . "' -"; + + push @filters, "bk log -d'\$unless(:MERGE:){$file_rev_dspec}' -" + unless $want_merge_changes; + + my $tmpname = "$bktmp/ibchanges.txt"; + my $pipeline = join(' | ', @filters) . " > $tmpname"; + open TMP, '|-', $pipeline + or die "$0: can't exec [[$pipeline]]: $!\n"; + + print TMP @changes; + close_or_warn(TMP, "| $pipeline"); + + # Use bk log to describe the changes + open LOG, "bk log - < $tmpname |" + or die "$0: can't exec 'bk log - < $tmpname': $!\n"; + my @log = ; + close_or_warn(LOG, "bk log - < $tmpname |"); + + unlink $tmpname; + + return undef unless @log; + + return join('', @log); +} + + +# Ask user if they really want to commit. +# RETURN TRUE = YES, commit; FALSE = NO, do not commit + +sub innodb_inform_and_query_user +{ + my ($description) = @_; + + my $tmpname = "$bktmp/ibquery.txt"; + + open MESSAGE, "> $tmpname" + or die "$0: can't write message to '$tmpname': $!"; + + print MESSAGE <"; + push @headers, "From: $from"; + push @headers, "To: " . (join ', ', @innodb_to_email); + push @headers, "Cc: " . (join ', ', @innodb_cc_email) if @innodb_cc_email; + push @headers, + "Subject: InnoDB changes in $type $mysql_version tree ($cset_short)"; + push @headers, "X-CSetKey: <$cset_key>"; + + print SENDMAIL map { "$_\n" } @headers, ''; + + if ($type eq 'main') + { + print SENDMAIL <name) { - add_word(&ht,(char*) cmd->name); - cmd++; - } if (!rehash) DBUG_VOID_RETURN; @@ -1782,6 +2498,12 @@ static void build_completion_hash(bool rehash, bool write_info) completion_hash_clean(&ht); free_root(&hash_mem_root,MYF(0)); + /* hash this file's known subset of SQL commands */ + while (cmd->name) { + add_word(&ht,(char*) cmd->name); + cmd++; + } + /* hash MySQL functions (to be implemented) */ /* hash all database names */ @@ -2163,7 +2885,8 @@ com_charset(String *buffer __attribute__((unused)), char *line) static int com_go(String *buffer,char *line __attribute__((unused))) { - char buff[200], time_buff[32], *pos; + char buff[200]; /* about 110 chars used so far */ + char time_buff[52+3+1]; /* time max + space&parens + NUL */ MYSQL_RES *result; ulong timer, warnings= 0; uint error= 0; @@ -2224,6 +2947,8 @@ com_go(String *buffer,char *line __attribute__((unused))) do { + char *pos; + if (quick) { if (!(result=mysql_use_result(&mysql)) && mysql_field_count(&mysql)) @@ -2242,7 +2967,9 @@ com_go(String *buffer,char *line __attribute__((unused))) if (verbose >= 3 || !opt_silent) mysql_end_timer(timer,time_buff); else - time_buff[0]=0; + time_buff[0]= '\0'; + + /* Every branch must truncate buff . */ if (result) { if (!mysql_num_rows(result) && ! quick && !column_types_flag) @@ -3809,6 +4536,11 @@ static ulong start_timer(void) } +/** + Write as many as 52+1 bytes to buff, in the form of a legible duration of time. + + len("4294967296 days, 23 hours, 59 minutes, 60.00 seconds") -> 52 +*/ static void nice_time(double sec,char *buff,bool part_second) { ulong tmp; diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index fe2e48fdba1..6d0e78509a8 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -74,7 +74,7 @@ static struct my_option my_long_options[]= {"debug", '#', "Output debug log", (uchar* *) & default_dbug_option, (uchar* *) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .", + {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag, diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index ce0eceeb907..e71cf70d882 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -97,7 +97,7 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .", + {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", diff --git a/client/mysqldump.c b/client/mysqldump.c index 5f896a0a44f..cbde58215c7 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -113,6 +113,8 @@ static char *opt_password=0,*current_user=0, *log_error_file= NULL; static char **defaults_argv= 0; static char compatible_mode_normal_str[255]; +/* Server supports character_set_results session variable? */ +static my_bool server_supports_switching_charsets= TRUE; static ulong opt_compatible_mode= 0; #define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1 #define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2 @@ -243,7 +245,7 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log", (uchar**) &default_dbug_option, (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .", + {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", @@ -1239,11 +1241,27 @@ static void restore_time_zone(FILE *sql_file, } +/** + Switch charset for results to some specified charset. If the server does not + support character_set_results variable, nothing can be done here. As for + whether something should be done here, future new callers of this function + should be aware that the server lacking the facility of switching charsets is + treated as success. + + @note If the server lacks support, then nothing is changed and no error + condition is returned. + + @returns whether there was an error or not +*/ static int switch_character_set_results(MYSQL *mysql, const char *cs_name) { char query_buffer[QUERY_LENGTH]; size_t query_length; + /* Server lacks facility. This is not an error, by arbitrary decision . */ + if (!server_supports_switching_charsets) + return FALSE; + query_length= my_snprintf(query_buffer, sizeof (query_buffer), "SET SESSION character_set_results = '%s'", @@ -1457,11 +1475,14 @@ static int connect_to_db(char *host, char *user,char *passwd) DB_error(&mysql_connection, "when trying to connect"); DBUG_RETURN(1); } - /* - Don't dump SET NAMES with a pre-4.1 server (bug#7997). - */ if (mysql_get_server_version(&mysql_connection) < 40100) + { + /* Don't dump SET NAMES with a pre-4.1 server (bug#7997). */ opt_set_charset= 0; + + /* Don't switch charsets for 4.1 and earlier. (bug#34192). */ + server_supports_switching_charsets= FALSE; + } /* As we're going to set SQL_MODE, it would be lost on reconnect, so we cannot reconnect. @@ -4306,6 +4327,7 @@ static int do_show_master_status(MYSQL *mysql_con) my_printf_error(0, "Error: Binlogging on server not active", MYF(0)); mysql_free_result(master); + maybe_exit(EX_MYSQLERR); return 1; } mysql_free_result(master); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 954af0cff97..ac3b0e8efba 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -87,7 +87,7 @@ static struct my_option my_long_options[] = 0, 0, 0}, {"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .", + {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", diff --git a/client/mysqlshow.c b/client/mysqlshow.c index a43adb0d586..167ff5c6198 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -178,7 +178,7 @@ static struct my_option my_long_options[] = 0, 0, 0}, {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .", + {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", diff --git a/client/mysqlslap.c b/client/mysqlslap.c index d9bbeba9713..5ca0b1cd207 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -569,13 +569,13 @@ static struct my_option my_long_options[] = OPT_ARG, 0, 0, 0, 0, 0, 0}, #ifdef DBUG_OFF {"debug", '#', "This is a non-debug version. Catch this and exit.", - 0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, + 0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, #else {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", (uchar**) &default_dbug_option, (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .", + {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag, diff --git a/client/mysqltest.c b/client/mysqltest.c index 04a5eb43a9e..50f72377122 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -45,6 +45,10 @@ #ifdef HAVE_SYS_WAIT_H #include #endif +#ifdef __WIN__ +#include +#endif + /* Use cygwin for --exec and --system before 5.0 */ #if MYSQL_VERSION_ID < 50000 @@ -271,7 +275,7 @@ enum enum_commands { Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST, Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP, Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES, - Q_SEND_QUIT, Q_CHANGE_USER, + Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR, Q_UNKNOWN, /* Unknown command. */ Q_COMMENT, /* Comments, ignored. */ @@ -361,6 +365,9 @@ const char *command_names[]= "diff_files", "send_quit", "change_user", + "mkdir", + "rmdir", + 0 }; @@ -537,6 +544,17 @@ static int do_send_query(struct st_connection *cn, const char *q, int q_len, return 0; } +static void wait_query_thread_end(struct st_connection *con) +{ + if (!con->query_done) + { + pthread_mutex_lock(&con->mutex); + while (!con->query_done) + pthread_cond_wait(&con->cond, &con->mutex); + pthread_mutex_unlock(&con->mutex); + } +} + #else /*EMBEDDED_LIBRARY*/ #define do_send_query(cn,q,q_len,flags) mysql_send_query(&cn->mysql, q, q_len) @@ -1914,6 +1932,18 @@ void var_set_errno(int sql_errno) var_set_int("$mysql_errno", sql_errno); } + +/* + Update $mysql_get_server_version variable with version + of the currently connected server +*/ + +void var_set_mysql_get_server_version(MYSQL* mysql) +{ + var_set_int("$mysql_get_server_version", mysql_get_server_version(mysql)); +} + + /* Set variable from the result of a query @@ -2223,7 +2253,7 @@ int open_file(const char *name) if (!(cur_file->file = my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0)))) { cur_file--; - die("Could not open file '%s'", buff); + die("Could not open '%s' for reading", buff); } cur_file->file_name= my_strdup(buff, MYF(MY_FAE)); cur_file->lineno=1; @@ -2770,6 +2800,67 @@ void do_file_exist(struct st_command *command) } +/* + SYNOPSIS + do_mkdir + command called command + + DESCRIPTION + mkdir + Create the directory +*/ + +void do_mkdir(struct st_command *command) +{ + int error; + static DYNAMIC_STRING ds_dirname; + const struct command_arg mkdir_args[] = { + "dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to create" + }; + DBUG_ENTER("do_mkdir"); + + check_command_args(command, command->first_argument, + mkdir_args, sizeof(mkdir_args)/sizeof(struct command_arg), + ' '); + + DBUG_PRINT("info", ("creating directory: %s", ds_dirname.str)); + error= my_mkdir(ds_dirname.str, 0777, MYF(0)) != 0; + handle_command_error(command, error); + dynstr_free(&ds_dirname); + DBUG_VOID_RETURN; +} + +/* + SYNOPSIS + do_rmdir + command called command + + DESCRIPTION + rmdir + Remove the empty directory +*/ + +void do_rmdir(struct st_command *command) +{ + int error; + static DYNAMIC_STRING ds_dirname; + const struct command_arg rmdir_args[] = { + "dirname", ARG_STRING, TRUE, &ds_dirname, "Directory to remove" + }; + DBUG_ENTER("do_rmdir"); + + check_command_args(command, command->first_argument, + rmdir_args, sizeof(rmdir_args)/sizeof(struct command_arg), + ' '); + + DBUG_PRINT("info", ("removing directory: %s", ds_dirname.str)); + error= rmdir(ds_dirname.str) != 0; + handle_command_error(command, error); + dynstr_free(&ds_dirname); + DBUG_VOID_RETURN; +} + + /* Read characters from line buffer or file. This is needed to allow my_ungetc() to buffer MAX_DELIMITER_LENGTH characters for a file @@ -3982,6 +4073,10 @@ int select_connection_name(const char *name) if (!(cur_con= find_connection_by_name(name))) die("connection '%s' not found in connection pool", name); + + /* Update $mysql_get_server_version to that of current connection */ + var_set_mysql_get_server_version(&cur_con->mysql); + DBUG_RETURN(0); } @@ -4035,7 +4130,14 @@ void do_close_connection(struct st_command *command) con->mysql.net.vio = 0; } } -#endif +#else + /* + As query could be still executed in a separate theread + we need to check if the query's thread was finished and probably wait + (embedded-server specific) + */ + wait_query_thread_end(con); +#endif /*EMBEDDED_LIBRARY*/ if (con->stmt) mysql_stmt_close(con->stmt); con->stmt= 0; @@ -4187,11 +4289,13 @@ int connect_n_handle_errors(struct st_command *command, if (!mysql_real_connect(con, host, user, pass, db, port, sock ? sock: 0, CLIENT_MULTI_STATEMENTS)) { + var_set_errno(mysql_errno(con)); handle_error(command, mysql_errno(con), mysql_error(con), mysql_sqlstate(con), ds); return 0; /* Not connected */ } + var_set_errno(0); handle_no_error(command); return 1; /* Connected */ } @@ -4321,6 +4425,9 @@ void do_connect(struct st_command *command) (int) (sizeof(connections)/sizeof(struct st_connection))); } +#ifdef EMBEDDED_LIBRARY + con_slot->query_done= 1; +#endif if (!mysql_init(&con_slot->mysql)) die("Failed on mysql_init()"); if (opt_compress || con_compress) @@ -4369,6 +4476,9 @@ void do_connect(struct st_command *command) next_con++; /* if we used the next_con slot, advance the pointer */ } + /* Update $mysql_get_server_version to that of current connection */ + var_set_mysql_get_server_version(&cur_con->mysql); + dynstr_free(&ds_connection_name); dynstr_free(&ds_host); dynstr_free(&ds_user); @@ -5034,7 +5144,7 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .", + {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.", (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", @@ -5216,7 +5326,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), DBUG_ASSERT(cur_file == file_stack && cur_file->file == 0); if (!(cur_file->file= my_fopen(buff, O_RDONLY | FILE_BINARY, MYF(0)))) - die("Could not open %s: errno = %d", buff, errno); + die("Could not open '%s' for reading: errno = %d", buff, errno); cur_file->file_name= my_strdup(buff, MYF(MY_FAE)); cur_file->lineno= 1; break; @@ -5343,9 +5453,9 @@ void str_to_file2(const char *fname, char *str, int size, my_bool append) flags|= O_TRUNC; if ((fd= my_open(buff, flags, MYF(MY_WME | MY_FFNF))) < 0) - die("Could not open %s: errno = %d", buff, errno); + die("Could not open '%s' for writing: errno = %d", buff, errno); if (append && my_seek(fd, 0, SEEK_END, MYF(0)) == MY_FILEPOS_ERROR) - die("Could not find end of file %s: errno = %d", buff, errno); + die("Could not find end of file '%s': errno = %d", buff, errno); if (my_write(fd, (uchar*)str, size, MYF(MY_WME|MY_FNABP))) die("write failed"); my_close(fd, MYF(0)); @@ -5834,16 +5944,11 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, } #ifdef EMBEDDED_LIBRARY /* - Here we handle 'reap' command, so we need to check if the - query's thread was finished and probably wait + Here we handle 'reap' command, so we need to check if the + query's thread was finished and probably wait */ else if (flags & QUERY_REAP_FLAG) - { - pthread_mutex_lock(&cn->mutex); - while (!cn->query_done) - pthread_cond_wait(&cn->cond, &cn->mutex); - pthread_mutex_unlock(&cn->mutex); - } + wait_query_thread_end(cn); #endif /*EMBEDDED_LIBRARY*/ if (!(flags & QUERY_REAP_FLAG)) DBUG_VOID_RETURN; @@ -6314,6 +6419,8 @@ int util_query(MYSQL* org_mysql, const char* query){ if (!(mysql= mysql_init(mysql))) die("Failed in mysql_init()"); + /* enable local infile, in non-binary builds often disabled by default */ + mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, 0); safe_connect(mysql, "util", org_mysql->host, org_mysql->user, org_mysql->passwd, org_mysql->db, org_mysql->port, org_mysql->unix_socket); @@ -6907,6 +7014,9 @@ int main(int argc, char **argv) */ var_set_errno(-1); + /* Update $mysql_get_server_version to that of current connection */ + var_set_mysql_get_server_version(&cur_con->mysql); + if (opt_include) { open_file(opt_include); @@ -6962,6 +7072,8 @@ int main(int argc, char **argv) case Q_ECHO: do_echo(command); command_executed++; break; case Q_SYSTEM: do_system(command); break; case Q_REMOVE_FILE: do_remove_file(command); break; + case Q_MKDIR: do_mkdir(command); break; + case Q_RMDIR: do_rmdir(command); break; case Q_FILE_EXIST: do_file_exist(command); break; case Q_WRITE_FILE: do_write_file(command); break; case Q_APPEND_FILE: do_append_file(command); break; @@ -7309,7 +7421,7 @@ void timer_output(void) ulonglong timer_now(void) { - return my_getsystime() / 10000; + return my_micro_time() / 1000; } diff --git a/cmd-line-utils/libedit/el.h b/cmd-line-utils/libedit/el.h index c4b6cff2186..d9379d7c8aa 100644 --- a/cmd-line-utils/libedit/el.h +++ b/cmd-line-utils/libedit/el.h @@ -136,6 +136,8 @@ struct editline { protected int el_editmode(EditLine *, int, const char **); +#define el_isprint(x) ((unsigned char) (x) < 0x80 ? isprint(x) : 1) + #ifdef DEBUG #define EL_ABORT(a) do { \ fprintf(el->el_errfile, "%s, %d: ", \ diff --git a/cmd-line-utils/libedit/key.c b/cmd-line-utils/libedit/key.c index 090a2684e92..35fcf0651b2 100644 --- a/cmd-line-utils/libedit/key.c +++ b/cmd-line-utils/libedit/key.c @@ -618,7 +618,7 @@ key__decode_char(char *buf, int cnt, int ch) } else if (ch == '\\') { buf[cnt++] = '\\'; buf[cnt] = '\\'; - } else if (ch == ' ' || (isprint(ch) && !isspace(ch))) { + } else if (ch == ' ' || (el_isprint(ch) && !isspace(ch))) { buf[cnt] = ch; } else { buf[cnt++] = '\\'; @@ -660,7 +660,7 @@ key__decode_str(const char *str, char *buf, const char *sep) } else if (*p == '^' || *p == '\\') { *b++ = '\\'; *b++ = *p; - } else if (*p == ' ' || (isprint((unsigned char) *p) && + } else if (*p == ' ' || (el_isprint((unsigned char) *p) && !isspace((unsigned char) *p))) { *b++ = *p; } else { diff --git a/cmd-line-utils/libedit/map.c b/cmd-line-utils/libedit/map.c index d99c36ff665..6be9279b5e5 100644 --- a/cmd-line-utils/libedit/map.c +++ b/cmd-line-utils/libedit/map.c @@ -961,7 +961,7 @@ map_init_nls(EditLine *el) el_action_t *map = el->el_map.key; for (i = 0200; i <= 0377; i++) - if (isprint(i)) + if (el_isprint(i)) map[i] = ED_INSERT; } diff --git a/cmd-line-utils/libedit/read.c b/cmd-line-utils/libedit/read.c index 051f3e8e42e..51848c2038e 100644 --- a/cmd-line-utils/libedit/read.c +++ b/cmd-line-utils/libedit/read.c @@ -508,7 +508,7 @@ el_gets(EditLine *el, int *nread) el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) { if (cmdnum == VI_DELETE_PREV_CHAR && el->el_chared.c_redo.pos != el->el_chared.c_redo.buf - && isprint((unsigned char)el->el_chared.c_redo.pos[-1])) + && el_isprint((unsigned char)el->el_chared.c_redo.pos[-1])) el->el_chared.c_redo.pos--; else *el->el_chared.c_redo.pos++ = ch; diff --git a/cmd-line-utils/libedit/refresh.c b/cmd-line-utils/libedit/refresh.c index b2833d215c5..46aca15ef08 100644 --- a/cmd-line-utils/libedit/refresh.c +++ b/cmd-line-utils/libedit/refresh.c @@ -88,7 +88,7 @@ private void re_addc(EditLine *el, int c) { - if (isprint(c)) { + if (el_isprint(c)) { re_putc(el, c, 1); return; } @@ -964,7 +964,7 @@ re_refresh_cursor(EditLine *el) h = 1; v++; } - } else if (!isprint((unsigned char) c)) { + } else if (!el_isprint((unsigned char) c)) { h += 3; if (h > th) { /* if overflow, compensate */ h = h - th; @@ -1057,7 +1057,7 @@ re_fastaddc(EditLine *el) char mc = (c == '\177') ? '?' : (c | 0100); re_fastputc(el, '^'); re_fastputc(el, mc); - } else if (isprint((unsigned char) c)) { /* normal char */ + } else if (el_isprint((unsigned char) c)) { /* normal char */ re_fastputc(el, c); } else { re_fastputc(el, '\\'); diff --git a/cmd-line-utils/readline/bind.c b/cmd-line-utils/readline/bind.c index 3e4c45467b1..84bf37bc993 100644 --- a/cmd-line-utils/readline/bind.c +++ b/cmd-line-utils/readline/bind.c @@ -27,7 +27,7 @@ #endif #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/callback.c b/cmd-line-utils/readline/callback.c index ada04d8593b..2f7e4b78057 100644 --- a/cmd-line-utils/readline/callback.c +++ b/cmd-line-utils/readline/callback.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include "rlconf.h" diff --git a/cmd-line-utils/readline/compat.c b/cmd-line-utils/readline/compat.c index a66d210fd2e..3949bf6a16b 100644 --- a/cmd-line-utils/readline/compat.c +++ b/cmd-line-utils/readline/compat.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/complete.c b/cmd-line-utils/readline/complete.c index a0232b2afdf..916aa5dd9b9 100644 --- a/cmd-line-utils/readline/complete.c +++ b/cmd-line-utils/readline/complete.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/display.c b/cmd-line-utils/readline/display.c index 90676b7ef7b..b8699c34b82 100644 --- a/cmd-line-utils/readline/display.c +++ b/cmd-line-utils/readline/display.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/funmap.c b/cmd-line-utils/readline/funmap.c index 9c760cc3475..2d2a35ed0c8 100644 --- a/cmd-line-utils/readline/funmap.c +++ b/cmd-line-utils/readline/funmap.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #if !defined (BUFSIZ) diff --git a/cmd-line-utils/readline/histexpand.c b/cmd-line-utils/readline/histexpand.c index b7ebe7be9ba..b52b0685c47 100644 --- a/cmd-line-utils/readline/histexpand.c +++ b/cmd-line-utils/readline/histexpand.c @@ -23,7 +23,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/histfile.c b/cmd-line-utils/readline/histfile.c index 2f051a32563..d98293d933c 100644 --- a/cmd-line-utils/readline/histfile.c +++ b/cmd-line-utils/readline/histfile.c @@ -31,7 +31,7 @@ #endif #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/history.c b/cmd-line-utils/readline/history.c index 47f49b523be..c81101fc555 100644 --- a/cmd-line-utils/readline/history.c +++ b/cmd-line-utils/readline/history.c @@ -26,7 +26,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/histsearch.c b/cmd-line-utils/readline/histsearch.c index 1cc5875a4b4..b71965135cc 100644 --- a/cmd-line-utils/readline/histsearch.c +++ b/cmd-line-utils/readline/histsearch.c @@ -23,7 +23,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/input.c b/cmd-line-utils/readline/input.c index da5d771c481..62c0443d890 100644 --- a/cmd-line-utils/readline/input.c +++ b/cmd-line-utils/readline/input.c @@ -26,7 +26,7 @@ #endif #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/isearch.c b/cmd-line-utils/readline/isearch.c index 9f67bfc0801..8060adb97cd 100644 --- a/cmd-line-utils/readline/isearch.c +++ b/cmd-line-utils/readline/isearch.c @@ -27,7 +27,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/keymaps.c b/cmd-line-utils/readline/keymaps.c index 70d0cc08d3f..562c22d7558 100644 --- a/cmd-line-utils/readline/keymaps.c +++ b/cmd-line-utils/readline/keymaps.c @@ -21,7 +21,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #if defined (HAVE_STDLIB_H) diff --git a/cmd-line-utils/readline/kill.c b/cmd-line-utils/readline/kill.c index 031ddf47c5b..42c53948689 100644 --- a/cmd-line-utils/readline/kill.c +++ b/cmd-line-utils/readline/kill.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/macro.c b/cmd-line-utils/readline/macro.c index 00cd58d628c..3473f705335 100644 --- a/cmd-line-utils/readline/macro.c +++ b/cmd-line-utils/readline/macro.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/mbutil.c b/cmd-line-utils/readline/mbutil.c index 17dde53ed7b..e21708fb748 100644 --- a/cmd-line-utils/readline/mbutil.c +++ b/cmd-line-utils/readline/mbutil.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/misc.c b/cmd-line-utils/readline/misc.c index 94ecb25900a..e0e6893c60e 100644 --- a/cmd-line-utils/readline/misc.c +++ b/cmd-line-utils/readline/misc.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #if defined (HAVE_UNISTD_H) diff --git a/cmd-line-utils/readline/nls.c b/cmd-line-utils/readline/nls.c index bcee87561aa..6ec685ed9ea 100644 --- a/cmd-line-utils/readline/nls.c +++ b/cmd-line-utils/readline/nls.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/parens.c b/cmd-line-utils/readline/parens.c index 737f7675e93..fe1578ed3e2 100644 --- a/cmd-line-utils/readline/parens.c +++ b/cmd-line-utils/readline/parens.c @@ -28,7 +28,7 @@ #include "rlconf.h" #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/readline.c b/cmd-line-utils/readline/readline.c index d363c922fb5..3a0f533fcd6 100644 --- a/cmd-line-utils/readline/readline.c +++ b/cmd-line-utils/readline/readline.c @@ -23,7 +23,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/rldefs.h b/cmd-line-utils/readline/rldefs.h index 0f6c87446dd..dcdfc49fbbc 100644 --- a/cmd-line-utils/readline/rldefs.h +++ b/cmd-line-utils/readline/rldefs.h @@ -27,7 +27,7 @@ #define _RLDEFS_H_ #if defined (HAVE_CONFIG_H) -# include "config.h" +# include "config_readline.h" #endif #include "rlstdc.h" diff --git a/cmd-line-utils/readline/rltty.c b/cmd-line-utils/readline/rltty.c index 12f3a93e524..8c896bd3b26 100644 --- a/cmd-line-utils/readline/rltty.c +++ b/cmd-line-utils/readline/rltty.c @@ -23,7 +23,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/rlwinsize.h b/cmd-line-utils/readline/rlwinsize.h index 7838154d023..60729b0f549 100644 --- a/cmd-line-utils/readline/rlwinsize.h +++ b/cmd-line-utils/readline/rlwinsize.h @@ -26,7 +26,7 @@ #define _RLWINSIZE_H_ #if defined (HAVE_CONFIG_H) -# include "config.h" +# include "config_readline.h" #endif /* Try to find the definitions of `struct winsize' and TIOGCWINSZ */ diff --git a/cmd-line-utils/readline/savestring.c b/cmd-line-utils/readline/savestring.c index 820428d8881..d42bcadf5d7 100644 --- a/cmd-line-utils/readline/savestring.c +++ b/cmd-line-utils/readline/savestring.c @@ -21,7 +21,7 @@ 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #define READLINE_LIBRARY -#include +#include "config_readline.h" #ifdef HAVE_STRING_H # include #endif diff --git a/cmd-line-utils/readline/search.c b/cmd-line-utils/readline/search.c index 33cc4fc1e73..cfa5db1dc17 100644 --- a/cmd-line-utils/readline/search.c +++ b/cmd-line-utils/readline/search.c @@ -23,7 +23,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/shell.c b/cmd-line-utils/readline/shell.c index 346f8113d43..5d084476bed 100644 --- a/cmd-line-utils/readline/shell.c +++ b/cmd-line-utils/readline/shell.c @@ -23,7 +23,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/signals.c b/cmd-line-utils/readline/signals.c index 54f2a642846..65c2ff308f6 100644 --- a/cmd-line-utils/readline/signals.c +++ b/cmd-line-utils/readline/signals.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include /* Just for NULL. Yuck. */ diff --git a/cmd-line-utils/readline/tcap.h b/cmd-line-utils/readline/tcap.h index 58ab894d93e..04252e72f2d 100644 --- a/cmd-line-utils/readline/tcap.h +++ b/cmd-line-utils/readline/tcap.h @@ -25,7 +25,7 @@ #define _RLTCAP_H_ #if defined (HAVE_CONFIG_H) -# include "config.h" +# include "config_readline.h" #endif #if defined (HAVE_TERMCAP_H) diff --git a/cmd-line-utils/readline/terminal.c b/cmd-line-utils/readline/terminal.c index 547f6f5dfe5..a630bc02e05 100644 --- a/cmd-line-utils/readline/terminal.c +++ b/cmd-line-utils/readline/terminal.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/text.c b/cmd-line-utils/readline/text.c index 5c7241abb1c..bcb5a5c32fd 100644 --- a/cmd-line-utils/readline/text.c +++ b/cmd-line-utils/readline/text.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #if defined (HAVE_UNISTD_H) diff --git a/cmd-line-utils/readline/tilde.c b/cmd-line-utils/readline/tilde.c index 1b76c9f2404..d50f7a0ffa4 100644 --- a/cmd-line-utils/readline/tilde.c +++ b/cmd-line-utils/readline/tilde.c @@ -20,7 +20,7 @@ Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #if defined (HAVE_UNISTD_H) diff --git a/cmd-line-utils/readline/undo.c b/cmd-line-utils/readline/undo.c index 9d9bd25ba8f..5699193b14c 100644 --- a/cmd-line-utils/readline/undo.c +++ b/cmd-line-utils/readline/undo.c @@ -23,7 +23,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/util.c b/cmd-line-utils/readline/util.c index e44ef64349d..935c9c927c2 100644 --- a/cmd-line-utils/readline/util.c +++ b/cmd-line-utils/readline/util.c @@ -22,7 +22,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/vi_mode.c b/cmd-line-utils/readline/vi_mode.c index d0b7e330adc..25213cb762f 100644 --- a/cmd-line-utils/readline/vi_mode.c +++ b/cmd-line-utils/readline/vi_mode.c @@ -32,7 +32,7 @@ #if defined (VI_MODE) #if defined (HAVE_CONFIG_H) -# include +# include "config_readline.h" #endif #include diff --git a/cmd-line-utils/readline/xmalloc.c b/cmd-line-utils/readline/xmalloc.c index 8985d340d39..cf52da351a8 100644 --- a/cmd-line-utils/readline/xmalloc.c +++ b/cmd-line-utils/readline/xmalloc.c @@ -21,7 +21,7 @@ #define READLINE_LIBRARY #if defined (HAVE_CONFIG_H) -#include +#include "config_readline.h" #endif #include diff --git a/config/ac-macros/character_sets.m4 b/config/ac-macros/character_sets.m4 index 8c3e8ca73b7..ea2763a1cd4 100644 --- a/config/ac-macros/character_sets.m4 +++ b/config/ac-macros/character_sets.m4 @@ -199,7 +199,7 @@ do ;; *) AC_MSG_ERROR([Charset '$cs' not available. (Available are: $CHARSETS_AVAILABLE). - See the Installation chapter in the Reference Manual.]); + See the Installation chapter in the Reference Manual.]) esac done @@ -380,7 +380,7 @@ case $default_charset in ;; *) AC_MSG_ERROR([Charset $cs not available. (Available are: $CHARSETS_AVAILABLE). - See the Installation chapter in the Reference Manual.]); + See the Installation chapter in the Reference Manual.]) esac if test "$default_collation" = default; then @@ -405,7 +405,7 @@ else Collation $default_collation is not valid for character set $default_charset. Valid collations are: $default_charset_collations. See the Installation chapter in the Reference Manual. - ]); + ]) fi AC_DEFINE_UNQUOTED([MYSQL_DEFAULT_CHARSET_NAME], ["$default_charset"], diff --git a/config/ac-macros/ha_ndbcluster.m4 b/config/ac-macros/ha_ndbcluster.m4 index 9ea2e9972f7..9df96a7750b 100644 --- a/config/ac-macros/ha_ndbcluster.m4 +++ b/config/ac-macros/ha_ndbcluster.m4 @@ -2,9 +2,9 @@ dnl --------------------------------------------------------------------------- dnl Macro: MYSQL_CHECK_NDBCLUSTER dnl --------------------------------------------------------------------------- -NDB_VERSION_MAJOR=`echo $MYSQL_NO_DASH_VERSION | cut -d. -f1` -NDB_VERSION_MINOR=`echo $MYSQL_NO_DASH_VERSION | cut -d. -f2` -NDB_VERSION_BUILD=`echo $MYSQL_NO_DASH_VERSION | cut -d. -f3` +NDB_VERSION_MAJOR=`echo $MYSQL_NUMERIC_VERSION | cut -d. -f1` +NDB_VERSION_MINOR=`echo $MYSQL_NUMERIC_VERSION | cut -d. -f2` +NDB_VERSION_BUILD=`echo $MYSQL_NUMERIC_VERSION | cut -d. -f3` NDB_VERSION_STATUS=`echo $VERSION | sed 's/^[[-.0-9]]*//'` TEST_NDBCLUSTER="" diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4 index 975e48d0487..2fbb30383bd 100644 --- a/config/ac-macros/misc.m4 +++ b/config/ac-macros/misc.m4 @@ -631,7 +631,7 @@ case $SYSTEM_TYPE in esac if test "$CXX_VERSION" then - AC_MSG_CHECKING("C++ compiler version"); + AC_MSG_CHECKING("C++ compiler version") AC_MSG_RESULT("$CXX $CXX_VERSION") fi AC_SUBST(CXX_VERSION) diff --git a/configure.in b/configure.in index 953c4507343..4852d7e9c37 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM # # When changing major version number please also check switch statement # in mysqlbinlog::check_master_version(). -AM_INIT_AUTOMAKE(mysql, 5.1.24-maria-alpha) +AM_INIT_AUTOMAKE(mysql, 5.1.25-maria-alpha) AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 @@ -23,9 +23,19 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0 # Set all version vars based on $VERSION. How do we do this more elegant ? # Remember that regexps needs to quote [ and ] since this is run through m4 -MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|[[a-z]]*-.*$||"` -MYSQL_BASE_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|\.[[^.]]*$||"` -MYSQL_VERSION_ID=`echo $MYSQL_NO_DASH_VERSION | sed -e 's|[[^0-9.]].*$||;s|$|.|' | sed -e 's/[[^0-9.]]//g; s/\./ /g; s/ \([[0-9]]\) / 0\\1 /g; s/ //g'` +# We take some made up examples +# +# VERSION 5.1.40sp1-alpha 5.0.34a +# MYSQL_NO_DASH_VERSION 5.1.40sp1 5.0.34a +# MYSQL_NUMERIC_VERSION 5.1.40 5.0.34 +# MYSQL_BASE_VERSION 5.1 5.0 +# MYSQL_VERSION_ID 50140 50034 +# +MYSQL_NO_DASH_VERSION=`echo $VERSION | sed -e "s|-.*$||"` +MYSQL_NUMERIC_VERSION=`echo $MYSQL_NO_DASH_VERSION | sed -e "s|[[a-z]][[a-z0-9]]*$||"` +MYSQL_BASE_VERSION=`echo $MYSQL_NUMERIC_VERSION | sed -e "s|\.[[^.]]*$||"` +MYSQL_VERSION_ID=`echo $MYSQL_NUMERIC_VERSION | \ + awk -F. '{printf "%d%0.2d%0.2d", $1, $2, $3}'` # Add previous major version for debian package upgrade path MYSQL_PREVIOUS_BASE_VERSION=5.0 @@ -188,7 +198,7 @@ CC_VERSION=`$CC --version | sed 1q` esac if test $? -eq "0" then - AC_MSG_CHECKING("C Compiler version"); + AC_MSG_CHECKING("C Compiler version") AC_MSG_RESULT("$CC $CC_VERSION") else CC_VERSION="" @@ -813,8 +823,8 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \ sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \ unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \ sys/ioctl.h malloc.h sys/malloc.h sys/ipc.h sys/shm.h linux/config.h \ - sys/prctl.h \ - sys/resource.h sys/param.h port.h ieeefp.h) + sys/prctl.h sys/resource.h sys/param.h port.h ieeefp.h \ + execinfo.h) AC_CHECK_HEADERS([xfs/xfs.h]) @@ -1031,8 +1041,8 @@ case $SYSTEM_TYPE in ;; *hpux11.*) AC_MSG_WARN([Enabling workarounds for hpux 11]) - CFLAGS="$CFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT" - CXXFLAGS="$CXXFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT" + CFLAGS="$CFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT" + CXXFLAGS="$CXXFLAGS -DHPUX11 -DSNPRINTF_RETURN_TRUNC -DHAVE_BROKEN_PREAD -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT" if test "$with_named_thread" = "no" then AC_MSG_WARN([Using --with-named-thread=-lpthread]) @@ -1296,7 +1306,7 @@ See the Installation chapter in the Reference Manual for more information.]) AC_MSG_RESULT("no need to check headers") fi - AC_MSG_CHECKING("for pthread_create in -lpthread"); + AC_MSG_CHECKING("for pthread_create in -lpthread") ac_save_LIBS="$LIBS" LIBS="$LIBS -lpthread" AC_TRY_LINK( [#include ], @@ -1356,7 +1366,7 @@ then then AC_MSG_RESULT("yes") else - AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.]); + AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.]) fi AC_MSG_RESULT("yes") elif test -f /usr/local/lib/libpthread.a -o -f /usr/local/lib/libpthread.so @@ -1372,7 +1382,7 @@ then then AC_MSG_RESULT("yes") else - AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.]); + AC_MSG_ERROR([On SCO UNIX MySQL must be compiled with gcc. See the Installation chapter in the Reference Manual.]) fi AC_MSG_RESULT("yes") # Hack for SCO UnixWare 7.1.x @@ -1517,7 +1527,7 @@ else AC_MSG_RESULT("$with_posix_threads") if test "$with_posix_threads" = "no" then - AC_MSG_CHECKING("for pthread_create in -lpthread"); + AC_MSG_CHECKING("for pthread_create in -lpthread") ac_save_LIBS="$LIBS" LIBS="$LIBS -lpthread" CLIENT_THREAD_LIBS="-lpthread" @@ -1530,7 +1540,7 @@ else then LIBS=" $ac_save_LIBS -lpthreads" CLIENT_THREAD_LIBS="-lpthreads" - AC_MSG_CHECKING("for pthread_create in -lpthreads"); + AC_MSG_CHECKING("for pthread_create in -lpthreads") AC_TRY_LINK( [#include ], [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], @@ -1541,7 +1551,7 @@ else # This is for FreeBSD LIBS="$ac_save_LIBS -pthread" CLIENT_THREAD_LIBS="-pthread" - AC_MSG_CHECKING("for pthread_create in -pthread"); + AC_MSG_CHECKING("for pthread_create in -pthread") AC_TRY_LINK( [#include ], [ pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ], @@ -1915,7 +1925,7 @@ if test "$ac_cv_conv_longlong_to_float" != "yes" then AC_MSG_ERROR([Your compiler cannot convert a longlong value to a float! If you are using gcc 2.8.# you should upgrade to egcs 1.0.3 or newer and try -again]); +again]) fi fi AC_CHECK_TYPES([sigset_t, off_t], [], [], [#include ]) @@ -2041,7 +2051,7 @@ AC_CHECK_FUNCS(alarm bcmp bfill bmove bsearch bzero \ sighold sigset sigthreadmask port_create sleep thr_yield \ snprintf socket stpcpy strcasecmp strerror strsignal strnlen strpbrk strstr \ strtol strtoll strtoul strtoull tell tempnam thr_setconcurrency vidattr \ - posix_fallocate) + posix_fallocate backtrace backtrace_symbols backtrace_symbols_fd) # # @@ -2079,7 +2089,7 @@ CFLAGS="$ORG_CFLAGS" AC_CHECK_FUNC(fseeko, [if test "$large_file_support" = no -a "$TARGET_LINUX" = "true"; then - AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!"); + AC_MSG_ERROR("Found fseeko symbol but large_file_support is not enabled!") fi] ) @@ -2331,6 +2341,21 @@ then fi AC_MSG_RESULT("$netinet_inc") +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_CHECK_HEADERS(cxxabi.h) +AC_CACHE_CHECK([checking for abi::__cxa_demangle], mysql_cv_cxa_demangle, +[AC_TRY_LINK([#include ], [ + char *foo= 0; int bar= 0; + foo= abi::__cxa_demangle(foo, foo, 0, &bar); +], [mysql_cv_cxa_demangle=yes], [mysql_cv_cxa_demangle=no])]) +AC_LANG_RESTORE + +if test "x$mysql_cv_cxa_demangle" = xyes; then + AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1, + [Define to 1 if you have the `abi::__cxa_demangle' function.]) +fi + #-------------------------------------------------------------------- # Check for requested features #-------------------------------------------------------------------- diff --git a/dbug/dbug.c b/dbug/dbug.c index e46d6f1b232..5150618e940 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -454,7 +454,7 @@ void _db_process_(const char *name) /* * FUNCTION * - * ParseDbug parse control string and set current debugger settings + * DbugParse parse control string and set current debugger settings * * DESCRIPTION * @@ -481,7 +481,7 @@ void _db_process_(const char *name) * 0 - a list of functions was not changed */ -int ParseDbug(CODE_STATE *cs, const char *control) +int DbugParse(CODE_STATE *cs, const char *control) { const char *end; int rel, f_used=0; @@ -834,7 +834,7 @@ void _db_set_(const char *control) uint old_fflags; get_code_state_or_return; old_fflags=fflags(cs); - if (ParseDbug(cs, control)) + if (DbugParse(cs, control)) FixTraceFlags(old_fflags, cs); } @@ -863,7 +863,7 @@ void _db_push_(const char *control) get_code_state_or_return; old_fflags=fflags(cs); PushState(cs); - if (ParseDbug(cs, control)) + if (DbugParse(cs, control)) FixTraceFlags(old_fflags, cs); } @@ -887,7 +887,7 @@ void _db_set_init_(const char *control) CODE_STATE tmp_cs; bzero((uchar*) &tmp_cs, sizeof(tmp_cs)); tmp_cs.stack= &init_settings; - ParseDbug(&tmp_cs, control); + DbugParse(&tmp_cs, control); } /* diff --git a/dbug/user.r b/dbug/user.r index 0077a4e4ad5..527ad1f43cd 100644 --- a/dbug/user.r +++ b/dbug/user.r @@ -730,8 +730,9 @@ warning will be given. The DBUG_POP macro has no arguments. EX:\ \fCDBUG_POP\ ();\fR .SP 1 .LI DBUG_SET\ -Modifies the current debugger state on top of the stack using the -debug control string passed as the macro argument. Unless +Modifies the current debugger state on top of the stack or pushes +a new state if the current is set to the initial settings, using +the debug control string passed as the macro argument. Unless .I incremental control string is used (see below), it's equivalent to a combination of DBUG_POP and DBUG_PUSH. diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index 42561a97888..cec0db6a4ae 100755 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -44,6 +44,9 @@ TARGET_LINK_LIBRARIES(my_print_defaults strings mysys debug dbug taocrypt wsock3 ADD_EXECUTABLE(perror perror.c) TARGET_LINK_LIBRARIES(perror strings mysys debug dbug wsock32) +ADD_EXECUTABLE(resolveip resolveip.c) +TARGET_LINK_LIBRARIES(resolveip strings mysys debug dbug wsock32) + ADD_EXECUTABLE(replace replace.c) TARGET_LINK_LIBRARIES(replace strings mysys debug dbug wsock32) diff --git a/extra/perror.c b/extra/perror.c index fba7b69bfe4..237b2582d43 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -13,9 +13,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* Return error-text for system error messages and nisam messages */ +/* Return error-text for system error messages and handler messages */ -#define PERROR_VERSION "2.10" +#define PERROR_VERSION "2.11" #include #include @@ -30,6 +30,10 @@ static my_bool verbose, print_all_codes; +#include "../include/my_base.h" +#include "../mysys/my_handler_errors.h" +#include "../include/my_handler.h" + #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE static my_bool ndb_code; static char ndb_string[1024]; @@ -82,36 +86,6 @@ typedef struct ha_errors { static HA_ERRORS ha_errlist[]= { - { 120,"Didn't find key on read or update" }, - { 121,"Duplicate key on write or update" }, - { 123,"Someone has changed the row since it was read (while the table was locked to prevent it)" }, - { 124,"Wrong index given to function" }, - { 126,"Index file is crashed" }, - { 127,"Record-file is crashed" }, - { 128,"Out of memory" }, - { 130,"Incorrect file format" }, - { 131,"Command not supported by database" }, - { 132,"Old database file" }, - { 133,"No record read before update" }, - { 134,"Record was already deleted (or record file crashed)" }, - { 135,"No more room in record file" }, - { 136,"No more room in index file" }, - { 137,"No more records (read after end of file)" }, - { 138,"Unsupported extension used for table" }, - { 139,"Too big row"}, - { 140,"Wrong create options"}, - { 141,"Duplicate unique key or constraint on write or update"}, - { 142,"Unknown character set used"}, - { 143,"Conflicting table definitions in sub-tables of MERGE table"}, - { 144,"Table is crashed and last repair failed"}, - { 145,"Table was marked as crashed and should be repaired"}, - { 146,"Lock timed out; Retry transaction"}, - { 147,"Lock table is full; Restart program with a larger locktable"}, - { 148,"Updates are not allowed under a read only transactions"}, - { 149,"Lock deadlock; Retry transaction"}, - { 150,"Foreign key constraint is incorrectly formed"}, - { 151,"Cannot add a child row"}, - { 152,"Cannot delete a parent row"}, { -30999, "DB_INCOMPLETE: Sync didn't finish"}, { -30998, "DB_KEYEMPTY: Key/data deleted or never created"}, { -30997, "DB_KEYEXIST: The key/data pair already exists"}, @@ -193,6 +167,17 @@ static const char *get_ha_error_msg(int code) { HA_ERRORS *ha_err_ptr; + /* + If you got compilation error here about compile_time_assert array, check + that every HA_ERR_xxx constant has a corresponding error message in + handler_error_messages[] list (check mysys/ma_handler_errors.h and + include/my_base.h). + */ + compile_time_assert(HA_ERR_FIRST + array_elements(handler_error_messages) == + HA_ERR_LAST + 1); + if (code >= HA_ERR_FIRST && code <= HA_ERR_LAST) + return handler_error_messages[code - HA_ERR_FIRST]; + for (ha_err_ptr=ha_errlist ; ha_err_ptr->errcode ;ha_err_ptr++) if (ha_err_ptr->errcode == code) return ha_err_ptr->msg; @@ -210,6 +195,8 @@ int main(int argc,char *argv[]) if (get_options(&argc,&argv)) exit(1); + my_handler_error_register(); + error=0; #ifdef HAVE_SYS_ERRLIST if (print_all_codes) @@ -290,29 +277,24 @@ int main(int argc,char *argv[]) (const uchar*) "Unknown Error", 13) && (!unknown_error || strcmp(msg, unknown_error))) { - found=1; + found= 1; if (verbose) - printf("OS error code %3d: %s\n",code,msg); + printf("OS error code %3d: %s\n", code, msg); else puts(msg); } - + if ((msg= get_ha_error_msg(code))) + { + found= 1; + if (verbose) + printf("MySQL error code %3d: %s\n", code, msg); + else + puts(msg); + } if (!found) { - /* Error message still not found, look in handler error codes */ - if (!(msg=get_ha_error_msg(code))) - { - fprintf(stderr,"Illegal error code: %d\n",code); - error=1; - } - else - { - found= 1; - if (verbose) - printf("MySQL error code %3d: %s\n",code,msg); - else - puts(msg); - } + fprintf(stderr,"Illegal error code: %d\n", code); + error= 1; } } } diff --git a/extra/resolveip.c b/extra/resolveip.c index e5fede7fda8..5f2a9269f62 100644 --- a/extra/resolveip.c +++ b/extra/resolveip.c @@ -21,13 +21,15 @@ #include #include #include -#include -#include -#ifndef HAVE_BROKEN_NETINET_INCLUDES -#include +#ifndef WIN32 +# include +# include +# ifndef HAVE_BROKEN_NETINET_INCLUDES +# include +# endif +# include +# include #endif -#include -#include #include #include @@ -116,13 +118,21 @@ int main(int argc, char **argv) while (argc--) { +#ifndef WIN32 struct in_addr addr; +#endif ip = *argv++; /* Not compatible with IPv6! Probably should use getnameinfo(). */ +#ifdef WIN32 + taddr = inet_addr(ip); + if(taddr != INADDR_NONE) + { +#else if (inet_aton(ip, &addr) != 0) { taddr= addr.s_addr; +#endif if (taddr == htonl(INADDR_BROADCAST)) { puts("Broadcast"); diff --git a/extra/yassl/CMakeLists.txt b/extra/yassl/CMakeLists.txt index 26e682cbb0c..ffb72b831af 100755 --- a/extra/yassl/CMakeLists.txt +++ b/extra/yassl/CMakeLists.txt @@ -24,4 +24,5 @@ SET(YASSL_SOURCES src/buffer.cpp src/cert_wrapper.cpp src/crypto_wrapper.cpp sr src/yassl_imp.cpp src/yassl_int.cpp) IF(NOT SOURCE_SUBLIBS) ADD_LIBRARY(yassl ${YASSL_SOURCES}) + ADD_DEPENDENCIES(yassl GenError) ENDIF(NOT SOURCE_SUBLIBS) diff --git a/include/config-win.h b/include/config-win.h index 7a50f28c932..aab401346da 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -168,14 +168,12 @@ typedef uint rf_SetTimer; #define Socket_defined #define my_socket SOCKET -#define bool BOOL #define SIGPIPE SIGINT #define RETQSORTTYPE void #define QSORT_TYPE_IS_VOID #define RETSIGTYPE void #define SOCKET_SIZE_TYPE int #define my_socket_defined -#define bool_defined #define byte_defined #define HUGE_PTR #define STDCALL __stdcall /* Used by libmysql.dll */ @@ -267,73 +265,10 @@ inline double ulonglong2double(ulonglong value) #define tell(A) _telli64(A) #endif - #define STACK_DIRECTION -1 -/* Optimized store functions for Intel x86 */ - -#ifndef _WIN64 -#define sint2korr(A) (*((int16 *) (A))) -#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ - (((uint32) 255L << 24) | \ - (((uint32) (uchar) (A)[2]) << 16) |\ - (((uint32) (uchar) (A)[1]) << 8) | \ - ((uint32) (uchar) (A)[0])) : \ - (((uint32) (uchar) (A)[2]) << 16) |\ - (((uint32) (uchar) (A)[1]) << 8) | \ - ((uint32) (uchar) (A)[0]))) -#define sint4korr(A) (*((long *) (A))) -#define uint2korr(A) (*((uint16 *) (A))) -/* - ATTENTION ! - - Please, note, uint3korr reads 4 bytes (not 3) ! - It means, that you have to provide enough allocated space ! -*/ -#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF) -#define uint4korr(A) (*((unsigned long *) (A))) -#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ - (((uint32) ((uchar) (A)[1])) << 8) +\ - (((uint32) ((uchar) (A)[2])) << 16) +\ - (((uint32) ((uchar) (A)[3])) << 24)) +\ - (((ulonglong) ((uchar) (A)[4])) << 32)) -#define uint6korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) + \ - (((uint32) ((uchar) (A)[1])) << 8) + \ - (((uint32) ((uchar) (A)[2])) << 16) + \ - (((uint32) ((uchar) (A)[3])) << 24)) + \ - (((ulonglong) ((uchar) (A)[4])) << 32) + \ - (((ulonglong) ((uchar) (A)[5])) << 40)) -#define uint8korr(A) (*((ulonglong *) (A))) -#define sint8korr(A) (*((longlong *) (A))) -#define int2store(T,A) *((uint16*) (T))= (uint16) (A) -#define int3store(T,A) { *(T)= (uchar) ((A));\ - *(T+1)=(uchar) (((uint) (A) >> 8));\ - *(T+2)=(uchar) (((A) >> 16)); } -#define int4store(T,A) *((long *) (T))= (long) (A) -#define int5store(T,A) { *(T)= (uchar)((A));\ - *((T)+1)=(uchar) (((A) >> 8));\ - *((T)+2)=(uchar) (((A) >> 16));\ - *((T)+3)=(uchar) (((A) >> 24)); \ - *((T)+4)=(uchar) (((A) >> 32)); } -#define int6store(T,A) { *(T) =(uchar)((A)); \ - *((T)+1)=(uchar) (((A) >> 8)); \ - *((T)+2)=(uchar) (((A) >> 16)); \ - *((T)+3)=(uchar) (((A) >> 24)); \ - *((T)+4)=(uchar) (((A) >> 32)); \ - *((T)+5)=(uchar) (((A) >> 40)); } -#define int8store(T,A) *((ulonglong *) (T))= (ulonglong) (A) - -#define doubleget(V,M) do { *((long *) &V) = *((long*) M); \ - *(((long *) &V)+1) = *(((long*) M)+1); } while(0) -#define doublestore(T,V) do { *((long *) T) = *((long*) &V); \ - *(((long *) T)+1) = *(((long*) &V)+1); } while(0) -#define float4get(V,M) { *((long *) &(V)) = *((long*) (M)); } -#define floatstore(T,V) memcpy((uchar*)(T), (uchar*)(&V), sizeof(float)) -#define floatget(V,M) memcpy((uchar*)(&V), (uchar*)(M), sizeof(float)) -#define float8get(V,M) doubleget((V),(M)) -#define float4store(V,M) memcpy((uchar*) V,(uchar*) (&M),sizeof(float)) -#define float8store(V,M) doublestore((V),(M)) -#endif /* _WIN64 */ +/* Difference between GetSystemTimeAsFileTime() and now() */ +#define OFFSET_TO_EPOCH ULL(116444736000000000) #define HAVE_PERROR #define HAVE_VFPRINT @@ -482,4 +417,4 @@ inline double ulonglong2double(ulonglong value) #define HAVE_CHARSET_ujis 1 #define HAVE_CHARSET_utf8 1 #define HAVE_UCA_COLLATIONS 1 - +#define HAVE_BOOL 1 diff --git a/include/hash.h b/include/hash.h index d924e62a0ec..4ca8dc0e8bf 100644 --- a/include/hash.h +++ b/include/hash.h @@ -47,8 +47,9 @@ typedef struct st_hash { /* A search iterator state */ typedef uint HASH_SEARCH_STATE; -#define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,B,C,D,E,F,G, H CALLER_INFO) -my_bool _hash_init(HASH *hash, CHARSET_INFO *charset, +#define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,0,B,C,D,E,F,G,H CALLER_INFO) +#define hash_init2(A,B,C,D,E,F,G,H,I) _hash_init(A,B,C,D,E,F,G,H,I CALLER_INFO) +my_bool _hash_init(HASH *hash, uint growth_size,CHARSET_INFO *charset, ulong default_array_elements, size_t key_offset, size_t key_length, hash_get_key get_key, void (*free_element)(void*), uint flags CALLER_INFO_PROTO); @@ -69,7 +70,7 @@ my_bool hash_check(HASH *hash); /* Only in debug library */ #define hash_clear(H) bzero((char*) (H),sizeof(*(H))) #define hash_inited(H) ((H)->array.buffer != 0) #define hash_init_opt(A,B,C,D,E,F,G,H) \ - (!hash_inited(A) && _hash_init(A,B,C,D,E,F,G, H CALLER_INFO)) + (!hash_inited(A) && _hash_init(A,0,B,C,D,E,F,G, H CALLER_INFO)) #ifdef __cplusplus } diff --git a/include/m_ctype.h b/include/m_ctype.h index 9025507ce15..b85894e94f5 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -282,6 +282,7 @@ typedef struct charset_info_st MY_COLLATION_HANDLER *coll; } CHARSET_INFO; +#define ILLEGAL_CHARSET_INFO_NUMBER (~0U) extern CHARSET_INFO my_charset_bin; diff --git a/include/my_base.h b/include/my_base.h index ddefb5be7b4..ca9b875ebfa 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -188,16 +188,19 @@ enum ha_extra_function { executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY. */ HA_EXTRA_INSERT_WITH_UPDATE, + /* Inform handler that we will do a rename */ + HA_EXTRA_PREPARE_FOR_RENAME, /* Orders MERGE handler to attach or detach its child tables. Used at begin and end of a statement. */ HA_EXTRA_ATTACH_CHILDREN, - HA_EXTRA_DETACH_CHILDREN, - /* Inform handler that we will do a rename */ - HA_EXTRA_PREPARE_FOR_RENAME + HA_EXTRA_DETACH_CHILDREN }; +/* Compatible option, to be deleted in 6.0 */ +#define HA_EXTRA_PREPARE_FOR_DELETE HA_EXTRA_PREPARE_FOR_DROP + /* The following is parameter to ha_panic() */ enum ha_panic_function { @@ -414,8 +417,8 @@ enum ha_base_keytype { /* NULLs are not supported in spatial index */ #define HA_ERR_NULL_IN_SPATIAL 158 #define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */ -#define HA_ERR_NO_PARTITION_FOUND 160 /* There's no partition in table for - given value */ +/* There's no partition in table for given value */ +#define HA_ERR_NO_PARTITION_FOUND 160 #define HA_ERR_RBR_LOGGING_FAILED 161 /* Row-based binlogging of row failed */ #define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr */ /* @@ -434,14 +437,14 @@ enum ha_base_keytype { #define HA_ERR_RECORD_IS_THE_SAME 169 /* It is not possible to log this statement */ #define HA_ERR_LOGGING_IMPOSSIBLE 170 -#define HA_ERR_CORRUPT_EVENT 171 /* The event was corrupt, leading to */ - /* illegal data being read */ +/* The event was corrupt, leading to illegal data being read */ +#define HA_ERR_CORRUPT_EVENT 171 #define HA_ERR_NEW_FILE 172 /* New file format */ -#define HA_ERR_INITIALIZATION 173 /* Error during initialization */ -#define HA_ERR_FILE_TOO_SHORT 174 /* File too short */ -#define HA_ERR_WRONG_CRC 175 /* Wrong CRC on page */ -#define HA_ERR_ROWS_EVENT_APPLY 176 /* The event could not be processed */ - /* no other hanlder error happened */ +/* The event could not be processed no other handler error happened */ +#define HA_ERR_ROWS_EVENT_APPLY 173 +#define HA_ERR_INITIALIZATION 174 /* Error during initialization */ +#define HA_ERR_FILE_TOO_SHORT 175 /* File too short */ +#define HA_ERR_WRONG_CRC 176 /* Wrong CRC on page */ #define HA_ERR_LAST 176 /* Copy of last error nr */ /* Number of different errors */ diff --git a/include/my_global.h b/include/my_global.h index 6e44f88e340..47f7243e481 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -492,9 +492,6 @@ C_MODE_END #include /* HPUX 10.20 defines ulong here. UGLY !!! */ #define HAVE_ULONG #endif -#ifdef DONT_USE_FINITE /* HPUX 11.x has is_finite() */ -#undef HAVE_FINITE -#endif #if defined(HPUX10) && defined(_LARGEFILE64_SOURCE) && defined(THREAD) /* Fix bug in setrlimit */ #undef setrlimit @@ -865,9 +862,13 @@ typedef SOCKET_SIZE_TYPE size_socket; #define SIZE_T_MAX ~((size_t) 0) #endif -#ifndef HAVE_FINITE +#ifndef isfinite +#ifdef HAVE_FINITE +#define isfinite(x) finite(x) +#else #define finite(x) (1.0 / fabs(x) > 0.0) -#endif +#endif /* HAVE_FINITE */ +#endif /* isfinite */ #ifndef HAVE_ISNAN #define isnan(x) ((x) != (x)) @@ -877,7 +878,7 @@ typedef SOCKET_SIZE_TYPE size_socket; /* isinf() can be used in both C and C++ code */ #define my_isinf(X) isinf(X) #else -#define my_isinf(X) (!finite(X) && !isnan(X)) +#define my_isinf(X) (!isfinite(X) && !isnan(X)) #endif /* Define missing math constants. */ @@ -1074,7 +1075,7 @@ typedef off_t os_off_t; typedef uint8 int7; /* Most effective integer 0 <= x <= 127 */ typedef short int15; /* Most effective integer 0 <= x <= 32767 */ typedef int myf; /* Type of MyFlags in my_funcs */ -#if !defined(bool) && !defined(bool_defined) && (!defined(HAVE_BOOL) || !defined(__cplusplus)) +#if !defined(bool) && (!defined(HAVE_BOOL) || !defined(__cplusplus)) typedef char bool; /* Ordinary boolean values 0 1 */ #endif /* Macros for converting *constants* to the right type */ @@ -1145,7 +1146,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */ */ /* Optimized store functions for Intel x86 */ -#if defined(__i386__) && !defined(_WIN64) +#if defined(__i386__) || defined(_WIN32) #define sint2korr(A) (*((const int16 *) (A))) #define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \ (((uint32) 255L << 24) | \ @@ -1157,7 +1158,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */ ((uint32) (uchar) (A)[0]))) #define sint4korr(A) (*((const long *) (A))) #define uint2korr(A) (*((const uint16 *) (A))) -#ifdef HAVE_purify +#if defined(HAVE_purify) && !defined(_WIN32) #define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ (((uint32) ((uchar) (A)[1])) << 8) +\ (((uint32) ((uchar) (A)[2])) << 16)) @@ -1169,7 +1170,7 @@ typedef char bool; /* Ordinary boolean values 0 1 */ It means, that you have to provide enough allocated space ! */ #define uint3korr(A) (long) (*((const unsigned int *) (A)) & 0xFFFFFF) -#endif +#endif /* HAVE_purify && !_WIN32 */ #define uint4korr(A) (*((const uint32 *) (A))) #define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ (((uint32) ((uchar) (A)[1])) << 8) +\ @@ -1220,9 +1221,8 @@ do { doubleget_union _tmp; \ #define floatstore(T,V) memcpy((uchar*)(T), (const uchar*)(&V),sizeof(float)) #define floatget(V,M) memcpy((uchar*) &V,(const uchar*) (M),sizeof(float)) #define float8store(V,M) doublestore((V),(M)) -#endif /* __i386__ */ +#else -#ifndef sint2korr /* We're here if it's not a IA-32 architecture (Win32 and UNIX IA-32 defines were done before) @@ -1361,7 +1361,7 @@ do { doubleget_union _tmp; \ #define float8store(V,M) doublestore((V),(M)) #endif /* WORDS_BIGENDIAN */ -#endif /* sint2korr */ +#endif /* __i386__ OR _WIN32 */ /* Macro for reading 32-bit integer from network byte order (big-endian) diff --git a/include/my_handler.h b/include/my_handler.h index bb885a2b493..c98ed0fd17f 100644 --- a/include/my_handler.h +++ b/include/my_handler.h @@ -20,6 +20,10 @@ #include "myisampack.h" +#ifdef __cplusplus +extern "C" { +#endif + /* There is a hard limit for the maximum number of keys as there are only 8 bits in the index file header for the number of keys in a table. @@ -118,5 +122,8 @@ extern void my_handler_error_unregister(void); this amount of bytes. */ #define portable_sizeof_char_ptr 8 +#ifdef __cplusplus +} +#endif #endif /* _my_handler_h */ diff --git a/include/my_pthread.h b/include/my_pthread.h index 1841d91d8c5..f1ae75b516e 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -163,7 +163,7 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/ #define pthread_mutex_unlock(A) (LeaveCriticalSection(A),0) #define pthread_mutex_destroy(A) DeleteCriticalSection(A) #define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B)) -#define pthread_kill(A,B) pthread_dummy(ESRCH) +#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) #define pthread_join(A,B) (WaitForSingleObject((A), INFINITE) != WAIT_OBJECT_0) @@ -346,14 +346,14 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res); #define pthread_attr_setdetachstate(A,B) pthread_dummy(0) #define pthread_create(A,B,C,D) pthread_create((A),*(B),(C),(D)) #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) -#define pthread_kill(A,B) pthread_dummy(ESRCH) +#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) #undef pthread_detach_this_thread #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } #endif #ifdef HAVE_DARWIN5_THREADS #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) -#define pthread_kill(A,B) pthread_dummy(ESRCH) +#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) #define pthread_condattr_init(A) pthread_dummy(0) #define pthread_condattr_destroy(A) pthread_dummy(0) #undef pthread_detach_this_thread @@ -373,7 +373,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res); #ifndef pthread_sigmask #define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) #endif -#define pthread_kill(A,B) pthread_dummy(ESRCH) +#define pthread_kill(A,B) pthread_dummy((A) ? 0 : ESRCH) #undef pthread_detach_this_thread #define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(&tmp); } #elif !defined(__NETWARE__) /* HAVE_PTHREAD_ATTR_CREATE && !HAVE_SIGWAIT */ diff --git a/include/my_sys.h b/include/my_sys.h index aa923f47d4c..1d009ab5508 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -286,9 +286,11 @@ enum flush_type FLUSH_KEEP, /* flush block and keep it in the cache */ FLUSH_RELEASE, /* flush block and remove it from the cache */ FLUSH_IGNORE_CHANGED, /* remove block from the cache */ - /* as my_disable_flush_pagecache_blocks is always 0, it is - strictly equivalent to FLUSH_KEEP */ - FLUSH_FORCE_WRITE, + /* + As my_disable_flush_pagecache_blocks is always 0, the following option + is strictly equivalent to FLUSH_KEEP + */ + FLUSH_FORCE_WRITE /** @brief like FLUSH_KEEP but return immediately if file is already being flushed (even partially) by another thread; only for page cache, diff --git a/include/myisam.h b/include/myisam.h index 8452b25098a..3f756abdbee 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -44,6 +44,8 @@ extern "C" { #define MI_MAX_KEY MAX_INDEXES /* Max allowed keys */ #endif +#define MI_MAX_POSSIBLE_KEY_BUFF HA_MAX_POSSIBLE_KEY_BUFF + #define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */ #define MI_NAME_IEXT ".MYI" #define MI_NAME_DEXT ".MYD" diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index 9ad4e499c55..fa38b90046d 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -717,6 +717,16 @@ int mysql_tmpfile(const char *prefix); */ int thd_killed(const MYSQL_THD thd); + +/** + Return the thread id of a user thread + + @param thd user thread connection handle + @return thread id +*/ +unsigned long thd_get_thread_id(const MYSQL_THD thd); + + /** Allocate memory in the connection's local memory pool diff --git a/include/mysql_com.h b/include/mysql_com.h index 3ac9f8283b6..e6e1a470469 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -148,6 +148,37 @@ enum enum_server_command #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) #define CLIENT_REMEMBER_OPTIONS (1UL << 31) +/* Gather all possible capabilites (flags) supported by the server */ +#define CLIENT_ALL_FLAGS (CLIENT_LONG_PASSWORD | \ + CLIENT_FOUND_ROWS | \ + CLIENT_LONG_FLAG | \ + CLIENT_CONNECT_WITH_DB | \ + CLIENT_NO_SCHEMA | \ + CLIENT_COMPRESS | \ + CLIENT_ODBC | \ + CLIENT_LOCAL_FILES | \ + CLIENT_IGNORE_SPACE | \ + CLIENT_PROTOCOL_41 | \ + CLIENT_INTERACTIVE | \ + CLIENT_SSL | \ + CLIENT_IGNORE_SIGPIPE | \ + CLIENT_TRANSACTIONS | \ + CLIENT_RESERVED | \ + CLIENT_SECURE_CONNECTION | \ + CLIENT_MULTI_STATEMENTS | \ + CLIENT_MULTI_RESULTS | \ + CLIENT_SSL_VERIFY_SERVER_CERT | \ + CLIENT_REMEMBER_OPTIONS) + +/* + Switch off the flags that are optional and depending on build flags + If any of the optional flags is supported by the build it will be switched + on before sending to the client during the connection handshake. +*/ +#define CLIENT_BASIC_FLAGS (((CLIENT_ALL_FLAGS & ~CLIENT_SSL) \ + & ~CLIENT_COMPRESS) \ + & ~CLIENT_SSL_VERIFY_SERVER_CERT) + #define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ #define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ #define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */ @@ -217,12 +248,12 @@ typedef struct st_net { functions and methods to maintain proper locking. */ unsigned char *query_cache_query; - unsigned int client_last_errno; + unsigned int last_errno; unsigned char error; my_bool unused2; /* Please remove with the next incompatible ABI change. */ my_bool return_errno; /** Client library error message buffer. Actually belongs to struct MYSQL. */ - char client_last_error[MYSQL_ERRMSG_SIZE]; + char last_error[MYSQL_ERRMSG_SIZE]; /** Client library sqlstate buffer. Set along with the error message. */ char sqlstate[SQLSTATE_LENGTH+1]; void *extension; diff --git a/include/mysql_h.ic b/include/mysql_h.ic index 4f138d9a229..832678a106b 100644 --- a/include/mysql_h.ic +++ b/include/mysql_h.ic @@ -106,9 +106,9 @@ typedef struct st_mysql_ftparser_param MYSQL_FTPARSER_PARAM; typedef struct st_mysql_methods MYSQL_METHODS; # 47 "mysql_time.h" typedef struct st_mysql_time MYSQL_TIME; -# 384 "mysql_com.h" +# 383 "mysql_com.h" typedef struct st_udf_args UDF_ARGS; -# 398 "mysql_com.h" +# 397 "mysql_com.h" typedef struct st_udf_init UDF_INIT; # 26 "my_alloc.h" typedef struct st_used_mem USED_MEM; @@ -130,7 +130,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo unsigned int mbminlen; unsigned int mbmaxlen; }; -# 370 "mysql_com.h" +# 369 "mysql_com.h" struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(double)))) rand_struct { unsigned long int seed1; @@ -542,11 +542,11 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned my_bool compress; my_bool unused1; unsigned char * query_cache_query; - unsigned int client_last_errno; + unsigned int last_errno; unsigned char error; my_bool unused2; my_bool return_errno; - char client_last_error[512]; + char last_error[512]; char sqlstate[(5 + 1)]; void * extension; }; @@ -558,7 +558,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo char const * * type_names; unsigned int * type_lengths; }; -# 384 "mysql_com.h" +# 383 "mysql_com.h" struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_udf_args { unsigned int arg_count; @@ -570,7 +570,7 @@ struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(vo unsigned long int * attribute_lengths; void * extension; }; -# 398 "mysql_com.h" +# 397 "mysql_com.h" struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(void *)))) st_udf_init { my_bool maybe_null; @@ -587,7 +587,7 @@ struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned unsigned int left; unsigned int size; }; -# 381 "mysql_com.h" +# 380 "mysql_com.h" enum Item_result { STRING_RESULT = 0, @@ -596,7 +596,7 @@ enum Item_result ROW_RESULT = 3, DECIMAL_RESULT = 4, }; -# 322 "mysql_com.h" +# 321 "mysql_com.h" enum enum_cursor_type { CURSOR_TYPE_NO_CURSOR = 0, @@ -604,7 +604,7 @@ enum enum_cursor_type CURSOR_TYPE_FOR_UPDATE = 2, CURSOR_TYPE_SCROLLABLE = 4, }; -# 235 "mysql_com.h" +# 234 "mysql_com.h" enum enum_field_types { MYSQL_TYPE_DECIMAL = 0, @@ -651,7 +651,7 @@ enum enum_ftparser_mode MYSQL_FTPARSER_WITH_STOPWORDS = 1, MYSQL_FTPARSER_FULL_BOOLEAN_INFO = 2, }; -# 332 "mysql_com.h" +# 331 "mysql_com.h" enum enum_mysql_set_option { MYSQL_OPTION_MULTI_STATEMENTS_ON = 0, @@ -730,7 +730,7 @@ enum enum_stmt_attr_type STMT_ATTR_CURSOR_TYPE = 1, STMT_ATTR_PREFETCH_ROWS = 2, }; -# 297 "mysql_com.h" +# 296 "mysql_com.h" enum mysql_enum_shutdown_level { SHUTDOWN_DEFAULT = 0, @@ -790,13 +790,13 @@ enum mysql_status MYSQL_STATUS_GET_RESULT = 1, MYSQL_STATUS_USE_RESULT = 2, }; -# 439 "mysql_com.h" +# 441 "mysql_com.h" extern my_bool check_scramble(char const * reply, char const * message, unsigned char const * hash_stage2); -# 432 "mysql_com.h" +# 434 "mysql_com.h" extern my_bool check_scramble_323(char const *, char const * message, unsigned long int * salt); # 35 "typelib.h" extern TYPELIB * copy_typelib(MEM_ROOT * root, TYPELIB * from); -# 427 "mysql_com.h" +# 429 "mysql_com.h" extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st); # 32 "typelib.h" extern int find_type(char * x, TYPELIB const * typelib, unsigned int); @@ -804,15 +804,15 @@ extern int find_type(char * x, TYPELIB const * typelib, unsigned int); extern int find_type_or_exit(char const * x, TYPELIB * typelib, char const * option); # 29 "typelib.h" extern my_ulonglong find_typeset(char * x, TYPELIB * typelib, int * error_position); -# 441 "mysql_com.h" +# 443 "mysql_com.h" extern void get_salt_from_password(unsigned char * res, char const * password); -# 434 "mysql_com.h" +# 436 "mysql_com.h" extern void get_salt_from_password_323(unsigned long int * res, char const * password); -# 447 "mysql_com.h" +# 449 "mysql_com.h" extern char * get_tty_password(char const * opt_message); # 34 "typelib.h" extern char const * get_type(TYPELIB * typelib, unsigned int); -# 429 "mysql_com.h" +# 431 "mysql_com.h" extern void hash_password(unsigned long int * to, char const * password, unsigned int); # 30 "my_list.h" extern LIST * list_add(LIST * root, LIST * element); @@ -828,31 +828,31 @@ extern unsigned int list_length(LIST *); extern LIST * list_reverse(LIST * root); # 36 "my_list.h" extern int list_walk(LIST *, list_walk_action, unsigned char * argument); -# 442 "mysql_com.h" +# 444 "mysql_com.h" extern void make_password_from_salt(char * to, unsigned char const * hash_stage2); -# 435 "mysql_com.h" -extern void make_password_from_salt_323(char * to, unsigned long int const * salt); # 437 "mysql_com.h" +extern void make_password_from_salt_323(char * to, unsigned long int const * salt); +# 439 "mysql_com.h" extern void make_scrambled_password(char * to, char const * password); -# 430 "mysql_com.h" +# 432 "mysql_com.h" extern void make_scrambled_password_323(char * to, char const * password); # 33 "typelib.h" extern void make_type(char * to, unsigned int, TYPELIB * typelib); -# 367 "mysql_com.h" +# 366 "mysql_com.h" extern int my_connect(my_socket, struct sockaddr const * name, unsigned int, unsigned int); -# 344 "mysql_com.h" +# 343 "mysql_com.h" extern my_bool my_net_init(NET * net, Vio * vio); -# 345 "mysql_com.h" +# 344 "mysql_com.h" extern void my_net_local_init(NET * net); -# 355 "mysql_com.h" +# 354 "mysql_com.h" extern unsigned long int my_net_read(NET * net); -# 350 "mysql_com.h" +# 349 "mysql_com.h" extern my_bool my_net_write(NET * net, unsigned char const * packet, size_t); -# 426 "mysql_com.h" +# 428 "mysql_com.h" extern double my_rnd(struct rand_struct *); -# 453 "mysql_com.h" +# 455 "mysql_com.h" extern void my_thread_end(void); -# 452 "mysql_com.h" +# 454 "mysql_com.h" extern my_bool my_thread_init(void); # 560 "mysql.h" extern void myodbc_remove_escape(MYSQL * mysql, char * name); @@ -890,7 +890,7 @@ extern void mysql_enable_rpl_parse(MYSQL * mysql); extern my_bool mysql_eof(MYSQL_RES * res); # 423 "mysql.h" extern unsigned int mysql_errno(MYSQL * mysql); -# 448 "mysql_com.h" +# 450 "mysql_com.h" extern char const * mysql_errno_to_sqlstate(unsigned int); # 424 "mysql.h" extern char const * mysql_error(MYSQL * mysql); @@ -1108,25 +1108,25 @@ extern char * mysql_unix_port; extern MYSQL_RES * mysql_use_result(MYSQL * mysql); # 426 "mysql.h" extern unsigned int mysql_warning_count(MYSQL * mysql); -# 347 "mysql_com.h" -extern void net_clear(NET * net, my_bool); # 346 "mysql_com.h" +extern void net_clear(NET * net, my_bool); +# 345 "mysql_com.h" extern void net_end(NET * net); -# 349 "mysql_com.h" -extern my_bool net_flush(NET * net); -# 354 "mysql_com.h" -extern int net_real_write(NET * net, unsigned char const * packet, size_t); # 348 "mysql_com.h" +extern my_bool net_flush(NET * net); +# 353 "mysql_com.h" +extern int net_real_write(NET * net, unsigned char const * packet, size_t); +# 347 "mysql_com.h" extern my_bool net_realloc(NET * net, size_t); -# 351 "mysql_com.h" +# 350 "mysql_com.h" extern my_bool net_write_command(NET * net, unsigned char, unsigned char const * header, size_t, unsigned char const * packet, size_t); -# 443 "mysql_com.h" +# 445 "mysql_com.h" extern char * octet2hex(char * to, char const * str, unsigned int); -# 424 "mysql_com.h" +# 426 "mysql_com.h" extern void randominit(struct rand_struct *, unsigned long int, unsigned long int); -# 438 "mysql_com.h" +# 440 "mysql_com.h" extern void scramble(char * to, char const * message, char const * password); -# 431 "mysql_com.h" +# 433 "mysql_com.h" extern void scramble_323(char * to, char const * message, char const * password); # 37 "typelib.h" extern TYPELIB sql_protocol_typelib; diff --git a/include/sql_common.h b/include/sql_common.h index 56e7305130f..9e43d076ba9 100644 --- a/include/sql_common.h +++ b/include/sql_common.h @@ -15,6 +15,7 @@ extern const char *unknown_sqlstate; +extern const char *cant_connect_sqlstate; extern const char *not_error_sqlstate; #ifdef __cplusplus diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 8ed723ea419..6e3e29e79b2 100755 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -98,7 +98,7 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c ../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c ../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c ../mysys/mf_qsort.c - ../mysys/my_getsystime.c ${LIB_SOURCES}) + ../mysys/my_getsystime.c ../mysys/my_sync.c ${LIB_SOURCES}) # Need to set USE_TLS for building the DLL, since __declspec(thread) # approach to thread local storage does not work properly in DLLs. diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 24fc95671ba..98eb7156de0 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -440,11 +440,11 @@ static void expand_error(MYSQL* mysql, int error) char tmp[MYSQL_ERRMSG_SIZE]; char *p; uint err_length; - strmake(tmp, mysql->net.client_last_error, MYSQL_ERRMSG_SIZE-1); - p = strmake(mysql->net.client_last_error, ER(error), MYSQL_ERRMSG_SIZE-1); - err_length= (uint) (p - mysql->net.client_last_error); + strmake(tmp, mysql->net.last_error, MYSQL_ERRMSG_SIZE-1); + p = strmake(mysql->net.last_error, ER(error), MYSQL_ERRMSG_SIZE-1); + err_length= (uint) (p - mysql->net.last_error); strmake(p, tmp, MYSQL_ERRMSG_SIZE-1 - err_length); - mysql->net.client_last_errno = error; + mysql->net.last_errno = error; } /* @@ -870,10 +870,10 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename) VOID(my_net_write(net,(const uchar*) "",0)); /* Server needs one packet */ net_flush(net); strmov(net->sqlstate, unknown_sqlstate); - net->client_last_errno= + net->last_errno= (*options->local_infile_error)(li_ptr, - net->client_last_error, - sizeof(net->client_last_error)-1); + net->last_error, + sizeof(net->last_error)-1); goto err; } @@ -900,10 +900,10 @@ my_bool handle_local_infile(MYSQL *mysql, const char *net_filename) if (readcount < 0) { - net->client_last_errno= + net->last_errno= (*options->local_infile_error)(li_ptr, - net->client_last_error, - sizeof(net->client_last_error)-1); + net->last_error, + sizeof(net->last_error)-1); goto err; } @@ -1397,7 +1397,7 @@ const char *cli_read_statistics(MYSQL *mysql) if (!mysql->net.read_pos[0]) { set_mysql_error(mysql, CR_WRONG_HOST_INFO, unknown_sqlstate); - return mysql->net.client_last_error; + return mysql->net.last_error; } return (char*) mysql->net.read_pos; } @@ -1408,7 +1408,7 @@ mysql_stat(MYSQL *mysql) { DBUG_ENTER("mysql_stat"); if (simple_command(mysql,COM_STATISTICS,0,0,0)) - DBUG_RETURN(mysql->net.client_last_error); + DBUG_RETURN(mysql->net.last_error); DBUG_RETURN((*mysql->methods->read_statistics)(mysql)); } @@ -1500,7 +1500,7 @@ my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql) const char *STDCALL mysql_sqlstate(MYSQL *mysql) { - return mysql->net.sqlstate; + return mysql ? mysql->net.sqlstate : cant_connect_sqlstate; } uint STDCALL mysql_warning_count(MYSQL *mysql) @@ -1773,7 +1773,7 @@ static my_bool my_realloc_str(NET *net, ulong length) if (res) { strmov(net->sqlstate, unknown_sqlstate); - strmov(net->client_last_error, ER(net->client_last_errno)); + strmov(net->last_error, ER(net->last_errno)); } net->write_pos= net->buff+ buf_length; } @@ -1825,14 +1825,14 @@ void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net) { DBUG_ENTER("set_stmt_errmsg"); DBUG_PRINT("enter", ("error: %d/%s '%s'", - net->client_last_errno, + net->last_errno, net->sqlstate, - net->client_last_error)); + net->last_error)); DBUG_ASSERT(stmt != 0); - stmt->last_errno= net->client_last_errno; - if (net->client_last_error && net->client_last_error[0]) - strmov(stmt->last_error, net->client_last_error); + stmt->last_errno= net->last_errno; + if (net->last_error && net->last_error[0]) + strmov(stmt->last_error, net->last_error); strmov(stmt->sqlstate, net->sqlstate); DBUG_VOID_RETURN; @@ -2467,7 +2467,7 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) int4store(buff+5, 1); /* iteration count */ res= test(cli_advanced_command(mysql, COM_STMT_EXECUTE, buff, sizeof(buff), - (uchar*) packet, length, 1, NULL) || + (uchar*) packet, length, 1, stmt) || (*mysql->methods->read_query_result)(mysql)); stmt->affected_rows= mysql->affected_rows; stmt->server_status= mysql->server_status; @@ -2683,7 +2683,7 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row) int4store(buff + 4, stmt->prefetch_rows); /* number of rows to fetch */ if ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH, buff, sizeof(buff), (uchar*) 0, 0, - 1, NULL)) + 1, stmt)) { set_stmt_errmsg(stmt, net); return 1; @@ -3350,7 +3350,7 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number, */ if ((*mysql->methods->advanced_command)(mysql, COM_STMT_SEND_LONG_DATA, buff, sizeof(buff), (uchar*) data, - length, 1, NULL)) + length, 1, stmt)) { set_stmt_errmsg(stmt, &mysql->net); DBUG_RETURN(1); @@ -4747,6 +4747,13 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt) MYSQL_DATA *result= &stmt->result; DBUG_ENTER("mysql_stmt_store_result"); + if (!mysql) + { + /* mysql can be reset in mysql_close called from mysql_reconnect */ + set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + mysql= mysql->last_used_con; if (!stmt->field_count) @@ -4772,7 +4779,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt) int4store(buff, stmt->stmt_id); int4store(buff + 4, (int)~0); /* number of rows to fetch */ if (cli_advanced_command(mysql, COM_STMT_FETCH, buff, sizeof(buff), - (uchar*) 0, 0, 1, NULL)) + (uchar*) 0, 0, 1, stmt)) { set_stmt_errmsg(stmt, net); DBUG_RETURN(1); @@ -4959,7 +4966,7 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags) uchar buff[MYSQL_STMT_HEADER]; /* packet header: 4 bytes for stmt id */ int4store(buff, stmt->stmt_id); if ((*mysql->methods->advanced_command)(mysql, COM_STMT_RESET, buff, - sizeof(buff), 0, 0, 0, NULL)) + sizeof(buff), 0, 0, 0, stmt)) { set_stmt_errmsg(stmt, &mysql->net); stmt->state= MYSQL_STMT_INIT_DONE; diff --git a/libmysql/manager.c b/libmysql/manager.c index 27d35758f3e..53ffffa55c0 100644 --- a/libmysql/manager.c +++ b/libmysql/manager.c @@ -160,7 +160,7 @@ MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con, msg_len=strlen(msg_buf); if (my_net_write(&con->net,(uchar*) msg_buf,msg_len) || net_flush(&con->net)) { - con->last_errno=con->net.client_last_errno; + con->last_errno=con->net.last_errno; strmov(con->last_error,"Write error on socket"); goto err; } diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index 5d673bb340e..c2f342367dd 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -21,13 +21,14 @@ MYSQLDATAdir = $(localstatedir) MYSQLSHAREdir = $(pkgdatadir) MYSQLBASEdir= $(prefix) MYSQLLIBdir= $(libdir) +pkgplugindir = $(pkglibdir)/plugin EXTRA_DIST = libmysqld.def CMakeLists.txt DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \ -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \ -DDATADIR="\"$(MYSQLDATAdir)\"" \ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ - -DLIBDIR="\"$(MYSQLLIBdir)\"" + -DPLUGINDIR="\"$(pkgplugindir)\"" INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/sql -I$(top_srcdir)/sql \ -I$(top_srcdir)/sql/examples \ diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt index ee129ff2df0..a07d089c757 100644 --- a/libmysqld/examples/CMakeLists.txt +++ b/libmysqld/examples/CMakeLists.txt @@ -23,6 +23,9 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include IF(WIN32) ADD_DEFINITIONS(-DUSE_TLS) ENDIF(WIN32) + +ADD_DEFINITIONS(-DEMBEDDED_LIBRARY) + ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc ../../client/mysql.cc ../../client/readline.cc ../../client/sql_string.cc) diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index cb3b6a7115d..ec9356ce98d 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -38,6 +38,8 @@ C_MODE_START #include #include "embedded_priv.h" +extern unsigned int mysql_server_last_errno; +extern char mysql_server_last_error[MYSQL_ERRMSG_SIZE]; static my_bool emb_read_query_result(MYSQL *mysql); @@ -61,8 +63,8 @@ void embedded_get_error(MYSQL *mysql, MYSQL_DATA *data) { NET *net= &mysql->net; struct embedded_query_result *ei= data->embedded_info; - net->client_last_errno= ei->last_errno; - strmake(net->client_last_error, ei->info, sizeof(net->client_last_error)-1); + net->last_errno= ei->last_errno; + strmake(net->last_error, ei->info, sizeof(net->last_error)-1); memcpy(net->sqlstate, ei->sqlstate, sizeof(net->sqlstate)); mysql->server_status= ei->server_status; my_free(data, MYF(0)); @@ -685,7 +687,7 @@ int check_embedded_connection(MYSQL *mysql, const char *db) err: { NET *net= &mysql->net; - strmake(net->client_last_error, thd->main_da.message(), sizeof(net->client_last_error)-1); + strmake(net->last_error, thd->main_da.message(), sizeof(net->last_error)-1); memcpy(net->sqlstate, mysql_errno_to_sqlstate(thd->main_da.sql_errno()), sizeof(net->sqlstate)-1); @@ -1122,3 +1124,12 @@ bool Protocol::net_store_data(const uchar *from, size_t length) return FALSE; } + +int vprint_msg_to_log(enum loglevel level __attribute__((unused)), + const char *format, va_list argsi) +{ + vsnprintf(mysql_server_last_error, sizeof(mysql_server_last_error), + format, argsi); + mysql_server_last_errno= CR_UNKNOWN_ERROR; + return 0; +} diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index a8542f6fca9..aff9391e015 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -210,8 +210,8 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, error: DBUG_PRINT("error",("message: %u (%s)", - mysql->net.client_last_errno, - mysql->net.client_last_error)); + mysql->net.last_errno, + mysql->net.last_error)); { /* Free alloced memory */ my_bool free_me=mysql->free_me; diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index 0d2ed7ad509..48fc5a81c7b 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -108,6 +108,23 @@ drop table t1; set global binlog_cache_size=@bcs; set session autocommit = @ac; +# +# Bug#33798: prepared statements improperly handle large unsigned ints +# +--disable_warnings +drop table if exists t1; +--enable_warnings +reset master; +create table t1 (a bigint unsigned, b bigint(20) unsigned); +prepare stmt from "insert into t1 values (?,?)"; +set @a= 9999999999999999; +set @b= 14632475938453979136; +execute stmt using @a, @b; +deallocate prepare stmt; +drop table t1; +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /Server ver: [^,]*,/Server version,/ +show binlog events from 0; + --echo End of 5.0 tests # Test of a too big SET INSERT_ID: see if the truncated value goes diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test index 59d31c3a08b..2d63ae27aa3 100644 --- a/mysql-test/extra/binlog_tests/blackhole.test +++ b/mysql-test/extra/binlog_tests/blackhole.test @@ -151,7 +151,6 @@ CREATE TABLE t1(a INT) ENGINE=BLACKHOLE; INSERT DELAYED INTO t1 VALUES(1); DROP TABLE t1; -# End of 4.1 tests # #Bug#19717: DELETE Query Error on BLACKHOLE when using WHERE on column with UNIQUE INDEX @@ -168,7 +167,6 @@ ALTER TABLE t1 ADD PRIMARY KEY(a); DELETE FROM t1 WHERE a=10; DROP TABLE t1; -# End of 5.0 tests # Test that a transaction which is rolled back does not go into binlog # and that a transaction which is committed does @@ -193,4 +191,27 @@ show binlog events; drop table if exists t1; -# End of 5.1 tests +# +# Bug#35178 INSERT_ID not written to binary log for inserts against BLACKHOLE backed tables +# +# +# the test checks that explicitly prescribed with set insert_id= value +# preceeds the following autoincrement insert in a blachhole +# + +reset master; +create table t1 (a int auto_increment, primary key (a)) engine=blackhole; + +# not insert_id prescribed insert binlogs with the default set insert_id 1 +insert into t1 values (11), (NULL), (NULL), (NULL); +set insert_id= 3; +insert into t1 values (NULL), (33), (NULL); +set insert_id= 5; +insert into t1 values (55), (NULL); +source include/show_binlog_events2.inc; + +# cleanup +drop table t1; + + +# End of tests diff --git a/mysql-test/extra/binlog_tests/ctype_cp932.test b/mysql-test/extra/binlog_tests/ctype_cp932.test index 3deeea13997..33247550d62 100644 --- a/mysql-test/extra/binlog_tests/ctype_cp932.test +++ b/mysql-test/extra/binlog_tests/ctype_cp932.test @@ -404,8 +404,10 @@ DROP TABLE t4; SET collation_connection='cp932_japanese_ci'; -- source include/ctype_filesort.inc +-- source include/ctype_like_range_f1f2.inc SET collation_connection='cp932_bin'; -- source include/ctype_filesort.inc +-- source include/ctype_like_range_f1f2.inc # # Bug#29333 myisam corruption with diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test index 6ac8a89591a..6879089a1b7 100644 --- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test @@ -7,7 +7,7 @@ -- source include/have_log_bin.inc -- source include/have_innodb.inc --- source include/have_debug.inc + --disable_warnings drop table if exists t1, t2; diff --git a/mysql-test/extra/rpl_tests/rpl_stm_charset.test b/mysql-test/extra/rpl_tests/rpl_charset.test similarity index 86% rename from mysql-test/extra/rpl_tests/rpl_stm_charset.test rename to mysql-test/extra/rpl_tests/rpl_charset.test index 629ccdf69f7..8bcb60b0227 100644 --- a/mysql-test/extra/rpl_tests/rpl_stm_charset.test +++ b/mysql-test/extra/rpl_tests/rpl_charset.test @@ -1,9 +1,6 @@ # Replication of character sets. # This test will fail if the server/client does not support enough charsets. -# Requires statement logging --- source include/have_binlog_format_mixed_or_statement.inc - source include/master-slave.inc; --disable_warnings set timestamp=1000000000; @@ -52,14 +49,10 @@ insert into t1 (b) values(@@character_set_client); # collation_client does not exist insert into t1 (b) values(@@character_set_connection); insert into t1 (b) values(@@collation_connection); ---disable_query_log -select "--- --master--" as ""; ---enable_query_log +--echo --- --master-- select * from t1 order by a; sync_slave_with_master; ---disable_query_log -select "--- --slave--" as ""; ---enable_query_log +--echo --- --slave-- select * from mysqltest2.t1 order by a; connection master; @@ -70,14 +63,10 @@ insert into t1 (b) values(LEAST("M set collation_connection=latin1_german2_ci; insert into t1 (b) values(@@collation_connection); insert into t1 (b) values(LEAST("Müller","Muffler")); ---disable_query_log -select "--- --master--" as ""; ---enable_query_log +--echo --- --master-- select * from t1 order by a; sync_slave_with_master; ---disable_query_log -select "--- --slave--" as ""; ---enable_query_log +--echo --- --slave-- select * from mysqltest2.t1 order by a; # Presently charset info is not logged with LOAD DATA but it will @@ -96,20 +85,15 @@ connection master; set @a= _cp850 'Müller' collate cp850_general_ci; truncate table t1; insert into t1 (b) values(collation(@a)); ---disable_query_log -select "--- --master--" as ""; ---enable_query_log +--echo --- --master-- select * from t1 order by a; sync_slave_with_master; ---disable_query_log -select "--- --slave--" as ""; ---enable_query_log +--echo --- --slave-- select * from mysqltest2.t1 order by a; connection master; drop database mysqltest2; drop database mysqltest3; -source include/show_binlog_events.inc; sync_slave_with_master; # Check that we can change global.collation_server (since 5.0.3) @@ -153,10 +137,6 @@ sync_slave_with_master; select hex(c1), hex(c2) from t1; connection master; -# Let's have a look at generated SETs. -flush logs; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 drop table t1; sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test index 6fa2c9ac1b5..7e726828a1e 100644 --- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test +++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test @@ -403,45 +403,38 @@ sync_slave_with_master; # added columns do not have default values# # Expect: Proper error message # ########################################### -# Commented out due to Bug #23907 Extra Slave Col is not -# erroring on extra col with no default values. +# Bug#22234, Bug#23907 Extra Slave Col is not +# erroring on extra col with no default values. ######################################################## #--echo *** Create t9 on slave *** -#STOP SLAVE; -#RESET SLAVE; -#eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), -# d TIMESTAMP, -# e INT DEFAULT '1')ENGINE=$engine_type; +STOP SLAVE; +RESET SLAVE; +eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), + d TIMESTAMP, + e INT NOT NULL) ENGINE=$engine_type; -#--echo *** Create t9 on Master *** -#connection master; -#eval CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5) -# ) ENGINE=$engine_type; -#RESET MASTER; +--echo *** Create t9 on Master *** +connection master; +eval CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5) + ) ENGINE=$engine_type; +RESET MASTER; -#--echo *** Start Slave *** -#connection slave; -#START SLAVE; +--echo *** Start Slave *** +connection slave; +START SLAVE; -#--echo *** Master Data Insert *** -#connection master; -#set @b1 = 'b1b1b1b1'; -#set @b1 = concat(@b1,@b1); -#INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); +--echo *** Master Data Insert *** +connection master; +set @b1 = 'b1b1b1b1'; +set @b1 = concat(@b1,@b1); +INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); -#--echo ************************************************* -#--echo ** Currently giving wrong error see bug#22234 *** -#--echo ************************************************* -#sync_slave_with_master; -#connection slave; - -#--echo *** Select from T9 *** -#--source include/wait_for_slave_sql_to_stop.inc -#--replace_result $MASTER_MYPORT MASTER_PORT -#--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # -#--query_vertical SHOW SLAVE STATUS -#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -#START SLAVE; +--source include/wait_for_slave_sql_to_stop.inc +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # +--query_vertical SHOW SLAVE STATUS +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; +START SLAVE; #--echo *** Drop t9 *** #connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test index bb6afd73034..8f32ee674f8 100644 --- a/mysql-test/extra/rpl_tests/rpl_loaddata.test +++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test @@ -39,13 +39,6 @@ sync_with_master; select * from t1; select * from t3; -# We want to be sure that LOAD DATA is in the slave's binlog. -# But we can't simply read this binlog, because as the slave has not been -# restarted for this test, the file_id is uncertain (would cause test -# failures). So instead, we test if the binlog looks long enough to -# contain LOAD DATA. Since 5.0.3 we assume that binlog of 1292 is ok. -# If LOAD DATA was not logged, the binlog would be shorter. -show master status; connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index a5db4dfab4d..078d3d4557d 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -148,5 +148,5 @@ drop table t1; # End of 4.1 tests -sync_with_master; +sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test index 926c4106d6d..4677f6da25d 100644 --- a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test +++ b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test @@ -50,17 +50,30 @@ insert into t1 values (1,2); --echo connection master; -# here is actually a bug, since there is no begin statement, the -# query is autocommitted, and end_pos shows end of the insert and not -# end of the commit +--echo # Now check that that is in the apply_status table is consistant +--echo # with what is in the binlog +--echo +--echo # since insert is done with transactional engine, expect a BEGIN +--echo # at +--echo --replace_result $start_pos --replace_column 5 # --eval show binlog events from $start_pos limit 1 + +--echo +--echo # Now the insert, one step after +--echo +--replace_result $start_pos +--replace_column 2 # 5 # +--eval show binlog events from $start_pos limit 1,1 + +--echo +--echo # and the COMMIT should be at --echo --replace_result $start_pos $end_pos --replace_column 2 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ ---eval show binlog events from $start_pos limit 1,1 +--eval show binlog events from $start_pos limit 2,1 --echo diff --git a/mysql-test/extra/rpl_tests/rpl_row_charset.test b/mysql-test/extra/rpl_tests/rpl_row_charset.test deleted file mode 100644 index c1eccff9bd5..00000000000 --- a/mysql-test/extra/rpl_tests/rpl_row_charset.test +++ /dev/null @@ -1,179 +0,0 @@ -# Replication of character sets. -# This test will fail if the server/client does not support enough charsets. - ---disable_warnings -set timestamp=1000000000; -drop database if exists mysqltest2; -drop database if exists mysqltest3; ---enable_warnings - -create database mysqltest2 character set latin2; -set @@character_set_server=latin5; -create database mysqltest3; ---disable_query_log -select "--- --master--" as ""; ---enable_query_log -show create database mysqltest2; -show create database mysqltest3; -sync_slave_with_master; ---disable_query_log -select "--- --slave--" as ""; ---enable_query_log -show create database mysqltest2; -show create database mysqltest3; - -connection master; -set @@collation_server=armscii8_bin; -drop database mysqltest3; -create database mysqltest3; ---disable_query_log -select "--- --master--" as ""; ---enable_query_log -show create database mysqltest3; -sync_slave_with_master; ---disable_query_log -select "--- --slave--" as ""; ---enable_query_log -show create database mysqltest3; - -connection master; -use mysqltest2; ---eval create table t1 (a int auto_increment primary key, b varchar(100))engine=$engine_type; -set character_set_client=cp850, collation_connection=latin2_croatian_ci; -insert into t1 (b) values(@@character_set_server); -insert into t1 (b) values(@@collation_server); -# character_set_database and collation_database are not tested as they -# needn't be replicated (Bar said in Jan 2005). -insert into t1 (b) values(@@character_set_client); -# collation_client does not exist -insert into t1 (b) values(@@character_set_connection); -insert into t1 (b) values(@@collation_connection); ---disable_query_log -select "--- --master--" as ""; ---enable_query_log -select * from t1 order by a; -sync_slave_with_master; ---disable_query_log -select "--- --slave--" as ""; ---enable_query_log -select * from mysqltest2.t1 order by a; - -select "--- --muller--" as ""; -connection master; -set character_set_client=latin1, collation_connection=latin1_german1_ci; -truncate table t1; -insert into t1 (b) values(@@collation_connection); -insert into t1 (b) values(LEAST("Müller","Muffler")); -set collation_connection=latin1_german2_ci; -insert into t1 (b) values(@@collation_connection); -insert into t1 (b) values(LEAST("Müller","Muffler")); ---disable_query_log -select "--- --master--" as ""; ---enable_query_log -select * from t1 order by a; -sync_slave_with_master; ---disable_query_log -select "--- --slave--" as ""; ---enable_query_log -select * from mysqltest2.t1 order by a; - -# Presently charset info is not logged with LOAD DATA but it will -# change in Jan 2005 when Dmitri pushes his new LOAD DATA, -# before 5.0.3 goes out. When done, LOAD DATA INFILE should be tested -# here. - -# See if user var is prefixed with collation in binlog and replicated well. -# Note: replication of user variables is broken as far as derivation is -# concerned. That's because when we store a user variable in the binlog, -# we lose its derivation. So later on the slave, it's impossible to -# know if the collation was explicit or not, so we use DERIVATION_NONE, -# which provokes error messages (like 'Illegal mix of collation') when -# we replay the master's INSERT/etc statements. - - -select "--- --INSERT--" as ""; -connection master; -set @a= _cp850 'Müller' collate cp850_general_ci; -truncate table t1; -insert into t1 (b) values(collation(@a)); ---disable_query_log -select "--- --master--" as ""; ---enable_query_log -select * from t1 order by a; -sync_slave_with_master; ---disable_query_log -select "--- --slave--" as ""; ---enable_query_log -select * from mysqltest2.t1 order by a; - -connection master; -drop database mysqltest2; -drop database mysqltest3; -source include/show_binlog_events.inc; -sync_slave_with_master; - -# Check that we can change global.collation_server (since 5.0.3) - -select "--- --global--" as ""; -set global character_set_server=latin2; -set global character_set_server=latin1; # back -connection master; -set global character_set_server=latin2; -set global character_set_server=latin1; # back - -# Check that SET ONE_SHOT is really one shot - -select "--- --oneshot--" as ""; -set one_shot @@character_set_server=latin5; -set @@max_join_size=1000; -select @@character_set_server; -select @@character_set_server; -set @@character_set_server=latin5; -select @@character_set_server; -select @@character_set_server; - -# ONE_SHOT on not charset/collation stuff is not allowed --- error 1382 -set one_shot max_join_size=10; - -# Test of wrong character set numbers; -error 1115; -set character_set_client=9999999; -error 1273; -set collation_server=9999998; - -# This one was contributed by Sergey Petrunia (BUG#3943) - -select "--- --3943--" as ""; -use test; ---eval CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255))ENGINE=$engine_type; -SET CHARACTER_SET_CLIENT=koi8r, - CHARACTER_SET_CONNECTION=cp1251, - CHARACTER_SET_RESULTS=koi8r; -INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ'); -SET SQL_BIG_SELECTS=1; -select hex(c1), hex(c2) from t1; -sync_slave_with_master; -SET SQL_BIG_SELECTS=1; -select hex(c1), hex(c2) from t1; - -connection master; -# Let's have a look at generated SETs. ---replace_result $MYSQLTEST_VARDIR MYSQL_TEST_DIR/var -#--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 -drop table t1; -sync_slave_with_master; - -# -# BUG#6676: Derivation of variables must be correct on slave -# -select "--- --6676--" as ""; -connection master; -eval create table `t1` ( - `pk` varchar(10) not null default '', - primary key (`pk`) -) engine=$engine_type default charset=latin1; -set @p=_latin1 'test'; -update t1 set pk='test' where pk=@p; -drop table t1; -sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test index c4e6dbc84c2..214027160a9 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test +++ b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test @@ -15,7 +15,6 @@ SELECT * FROM t1 ORDER BY a; sync_slave_with_master; connection master; -source include/show_binlog_events.inc; sync_slave_with_master; SELECT * FROM t1 ORDER BY a; connection master; diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc new file mode 100644 index 00000000000..98f9c93b25a --- /dev/null +++ b/mysql-test/include/commit.inc @@ -0,0 +1,753 @@ +## Bug#12713 (Error in a stored function called from a SELECT doesn't cause +## ROLLBACK of statem) + +## +## Pre-Requisites : +## - $engine_type should be set +## + +set sql_mode=no_engine_substitution; +eval set storage_engine = $engine_type; +set autocommit=1; + +--disable_warnings +drop table if exists t1; +drop table if exists t2; +drop table if exists t3; +drop function if exists f2; +drop procedure if exists bug12713_call; +drop procedure if exists bug12713_dump_spvars; +drop procedure if exists dummy; +--enable_warnings + +create table t1 (a int); +create table t2 (a int unique); +create table t3 (a int); + +# a workaround for Bug#32633: Can not create any routine if +# SQL_MODE=no_engine_substitution + +set sql_mode=default; + +insert into t1 (a) values (1), (2); +insert into t3 (a) values (1), (2); + +delimiter |; + +## Cause a failure every time +create function f2(x int) returns int +begin + insert into t2 (a) values (x); + insert into t2 (a) values (x); + return x; +end| + +delimiter ;| + +set autocommit=0; + +flush status; +##============================================================================ +## Design notes +## +## In each case, statement rollback is expected. +## for transactional engines, the rollback should be properly executed +## for non transactional engines, the rollback may cause warnings. +## +## The test pattern is as follows +## - insert 1000+N +## - statement with a side effect, that fails to insert N twice +## - a statement rollback is expected (expecting 1 row 1000+N only) in t2 +## - a rollback is performed +## - expecting a clean table t2. +##============================================================================ + +insert into t2 (a) values (1001); +--error ER_DUP_ENTRY +insert into t1 (a) values (f2(1)); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1002); +--error ER_DUP_ENTRY +insert into t3 (a) select f2(2) from t1; +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1003); +--error ER_DUP_ENTRY +update t1 set a= a + f2(3); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1004); +--error ER_DUP_ENTRY +update t1, t3 set t1.a = 0, t3.a = 0 where (f2(4) = 4) and (t1.a = t3.a); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1005); +--error ER_DUP_ENTRY +delete from t1 where (a = f2(5)); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1006); +--error ER_DUP_ENTRY +delete from t1, t3 using t1, t3 where (f2(6) = 6) ; +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1007); +--error ER_DUP_ENTRY +replace t1 values (f2(7)); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1008); +--error ER_DUP_ENTRY +replace into t3 (a) select f2(8) from t1; +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1009); +--error ER_DUP_ENTRY +select f2(9) from t1 ; +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1010); +--error ER_DUP_ENTRY +show databases where (f2(10) = 10); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1011); +--error ER_DUP_ENTRY +show tables where (f2(11) = 11); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1012); +--error ER_DUP_ENTRY +show triggers where (f2(12) = 12); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1013); +--error ER_DUP_ENTRY +show table status where (f2(13) = 13); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1014); +--error ER_DUP_ENTRY +show open tables where (f2(14) = 14); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1015); +--error ER_DUP_ENTRY +show columns in mysql.proc where (f2(15) = 15); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1016); +--error ER_DUP_ENTRY +show status where (f2(16) = 16); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1017); +--error ER_DUP_ENTRY +show variables where (f2(17) = 17); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1018); +--error ER_DUP_ENTRY +show charset where (f2(18) = 18); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1019); +--error ER_DUP_ENTRY +show collation where (f2(19) = 19); +select * from t2; +rollback; +select * from t2; + +--echo # We need at least one procedure to make sure the WHERE clause is +--echo # evaluated +create procedure dummy() begin end; +insert into t2 (a) values (1020); +--error ER_DUP_ENTRY +show procedure status where (f2(20) = 20); +select * from t2; +rollback; +select * from t2; +drop procedure dummy; + +insert into t2 (a) values (1021); +--error ER_DUP_ENTRY +show function status where (f2(21) = 21); +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1022); +prepare stmt from "insert into t1 (a) values (f2(22))"; +--error ER_DUP_ENTRY +execute stmt; +select * from t2; +rollback; +select * from t2; + +insert into t2 (a) values (1023); +do (f2(23)); +select * from t2; +rollback; +select * from t2; + +## Please note : +## This will insert a record 1024 in t1 (statement commit) +## This will insert a record 24 in t1 (statement commit) +## then will rollback the second insert only (24) (statement rollback) +## then will rollback the complete transaction (transaction rollback) + +delimiter |; + +create procedure bug12713_call () +begin + insert into t2 (a) values (24); + insert into t2 (a) values (24); +end| + +delimiter ;| + +insert into t2 (a) values (1024); +--error ER_DUP_ENTRY +call bug12713_call(); +select * from t2; +rollback; +select * from t2; + +--echo ======================================================================= +--echo Testing select_to_file +--echo ======================================================================= + +insert into t2 (a) values (1025); + +--replace_result $MYSQLTEST_VARDIR .. +--error ER_DUP_ENTRY +eval select f2(25) into outfile "$MYSQLTEST_VARDIR/tmp/dml.out" from t1; +select * from t2; +rollback; +select * from t2; +--remove_file $MYSQLTEST_VARDIR/tmp/dml.out + +insert into t2 (a) values (1026); +--replace_result $MYSQLTEST_VARDIR .. +--error ER_DUP_ENTRY +eval load data infile "../std_data_ln/words.dat" into table t1 (a) set a:=f2(26); + +select * from t2; +rollback; +select * from t2; + +--echo ======================================================================= +--echo Testing select_dumpvar +--echo ======================================================================= + +insert into t2 (a) values (1027); +--error ER_DUP_ENTRY +select f2(27) into @foo; +select * from t2; +rollback; +select * from t2; + +--echo ======================================================================= +--echo Testing Select_fetch_into_spvars +--echo ======================================================================= + +delimiter |; + +create procedure bug12713_dump_spvars () +begin + declare foo int; + + declare continue handler for sqlexception + begin + select "Exception trapped"; + end; + + select f2(28) into foo; + select * from t2; +end| + +delimiter ;| + +insert into t2 (a) values (1028); +call bug12713_dump_spvars (); +rollback; +select * from t2; + +--echo ======================================================================= +--echo Cleanup +--echo ======================================================================= + +set autocommit=default; + +drop table t1; +drop table t2; +drop table t3; +drop function f2; +drop procedure bug12713_call; +drop procedure bug12713_dump_spvars; +--echo # +--echo # Bug#12713 Error in a stored function called from a SELECT doesn't +--echo # cause ROLLBACK of statem +--echo # +--echo # Verify that two-phase commit is not issued for read-only +--echo # transactions. +--echo # +--echo # Verify that two-phase commit is issued for read-write transactions, +--echo # even if the change is done inside a stored function called from +--echo # SELECT or SHOW statement. +--echo # +set autocommit=0; +--disable_warnings +drop table if exists t1; +drop table if exists t2; +drop function if exists f1; +drop procedure if exists p_verify_status_increment; +--enable_warnings + +# Save binlog_format in a user variable. References to system +# variables are "unsafe", meaning they are written as rows instead of +# as statements to the binlog, if the loggging mode is 'mixed'. But +# we don't want p_verify_status_increment to affect the logging mode. +# Hence, we save binlog_format in a user variable (which is not +# unsafe) and use that inside p_verify_status_increment. +set @binlog_format=@@global.binlog_format; + +set sql_mode=no_engine_substitution; +create table t1 (a int unique); +create table t2 (a int) engine=myisam; +set sql_mode=default; +--echo # +--echo # An auxiliary procedure to track Handler_prepare and Handler_commit +--echo # statistics. +--echo # +delimiter |; +create procedure +p_verify_status_increment(commit_inc_mixed int, prepare_inc_mixed int, + commit_inc_row int, prepare_inc_row int) +begin + declare commit_inc int; + declare prepare_inc int; + declare old_commit_count int default ifnull(@commit_count, 0); + declare old_prepare_count int default ifnull(@prepare_count, 0); + declare c_res int; +# Use a cursor to have just one access to I_S instead of 2, it is very slow +# and amounts for over 90% of test CPU time + declare c cursor for + select variable_value + from information_schema.session_status + where variable_name='Handler_commit' or variable_name='Handler_prepare' + order by variable_name; + + if @binlog_format = 'ROW' then + set commit_inc= commit_inc_row; + set prepare_inc= prepare_inc_row; + else + set commit_inc= commit_inc_mixed; + set prepare_inc= prepare_inc_mixed; + end if; + + open c; + fetch c into c_res; + set @commit_count=c_res; + fetch c into c_res; + set @prepare_count=c_res; + close c; + + if old_commit_count + commit_inc <> @commit_count then + select concat("Expected commit increment: ", commit_inc, + " actual: ", @commit_count - old_commit_count) + as 'ERROR'; + elseif old_prepare_count + prepare_inc <> @prepare_count then + select concat("Expected prepare increment: ", prepare_inc, + " actual: ", @prepare_count - old_prepare_count) + as 'ERROR'; + else + select '' as 'SUCCESS'; + end if; +end| +delimiter ;| +--echo # Reset Handler_commit and Handler_prepare counters +flush status; +--echo # +--echo # 1. Read-only statement: SELECT +--echo # +select * from t1; +call p_verify_status_increment(1, 0, 1, 0); +commit; +call p_verify_status_increment(1, 0, 1, 0); + +--echo # 2. Read-write statement: INSERT, insert 1 row. +--echo # +insert into t1 (a) values (1); +call p_verify_status_increment(2, 2, 2, 2); +commit; +call p_verify_status_increment(2, 2, 2, 2); + +--echo # 3. Read-write statement: UPDATE, update 1 row. +--echo # +update t1 set a=2; +call p_verify_status_increment(2, 2, 2, 2); +commit; +call p_verify_status_increment(2, 2, 2, 2); + +--echo # 4. Read-write statement: UPDATE, update 0 rows, 1 row matches WHERE +--echo # +update t1 set a=2; +call p_verify_status_increment(2, 2, 1, 0); +commit; +call p_verify_status_increment(2, 2, 1, 0); + +--echo # 5. Read-write statement: UPDATE, update 0 rows, 0 rows match WHERE +--echo # +--echo # In mixed replication mode, there is a read-only transaction +--echo # in InnoDB and also the statement is written to the binary log. +--echo # So we have two commits but no 2pc, since the first engine's +--echo # transaction is read-only. +--echo # In the row level replication mode, we only have the read-only +--echo # transaction in InnoDB and nothing is written to the binary log. +--echo # +update t1 set a=3 where a=1; +call p_verify_status_increment(2, 0, 1, 0); +commit; +call p_verify_status_increment(2, 0, 1, 0); + +--echo # 6. Read-write statement: DELETE, delete 0 rows. +--echo # +delete from t1 where a=1; +call p_verify_status_increment(2, 0, 1, 0); +commit; +call p_verify_status_increment(2, 0, 1, 0); + +--echo # 7. Read-write statement: DELETE, delete 1 row. +--echo # +delete from t1 where a=2; +call p_verify_status_increment(2, 2, 2, 2); +commit; +call p_verify_status_increment(2, 2, 2, 2); + +--echo # 8. Read-write statement: unqualified DELETE +--echo # +--echo # In statement or mixed replication mode, we call +--echo # handler::ha_delete_all_rows() and write statement text +--echo # to the binary log. This results in two read-write transactions. +--echo # In row level replication mode, we do not call +--echo # handler::ha_delete_all_rows(), but delete rows one by one. +--echo # Since there are no rows, nothing is written to the binary log. +--echo # Thus we have just one read-only transaction in InnoDB. +delete from t1; +call p_verify_status_increment(2, 2, 1, 0); +commit; +call p_verify_status_increment(2, 2, 1, 0); + +--echo # 9. Read-write statement: REPLACE, change 1 row. +--echo # +replace t1 set a=1; +call p_verify_status_increment(2, 2, 2, 2); +commit; +call p_verify_status_increment(2, 2, 2, 2); + +--echo # 10. Read-write statement: REPLACE, change 0 rows. +--echo # +replace t1 set a=1; +call p_verify_status_increment(2, 2, 1, 0); +commit; +call p_verify_status_increment(2, 2, 1, 0); + +--echo # 11. Read-write statement: IODKU, change 1 row. +--echo # +insert t1 set a=1 on duplicate key update a=a+1; +call p_verify_status_increment(2, 2, 2, 2); +select * from t1; +call p_verify_status_increment(1, 0, 1, 0); +commit; +call p_verify_status_increment(2, 2, 2, 2); + +--echo # 12. Read-write statement: IODKU, change 0 rows. +--echo # +insert t1 set a=2 on duplicate key update a=2; +call p_verify_status_increment(1, 0, 1, 0); +commit; +call p_verify_status_increment(1, 0, 1, 0); + +--echo # 13. Read-write statement: INSERT IGNORE, change 0 rows. +--echo # +insert ignore t1 set a=2; +call p_verify_status_increment(1, 0, 1, 0); +commit; +call p_verify_status_increment(1, 0, 1, 0); + +--echo # 14. Read-write statement: INSERT IGNORE, change 1 row. +--echo # +insert ignore t1 set a=1; +call p_verify_status_increment(2, 2, 2, 2); +commit; +call p_verify_status_increment(2, 2, 2, 2); +--echo # 15. Read-write statement: UPDATE IGNORE, change 0 rows. +--echo # +update ignore t1 set a=2 where a=1; +call p_verify_status_increment(2, 2, 1, 0); +commit; +call p_verify_status_increment(2, 2, 1, 0); +--echo # +--echo # Create a stored function that modifies a +--echo # non-transactional table. Demonstrate that changes in +--echo # non-transactional tables do not affect the two phase commit +--echo # algorithm. +--echo # +delimiter |; +create function f1() returns int +begin + insert t2 set a=2; + return 2; +end| +delimiter ;| +call p_verify_status_increment(0, 0, 0, 0); + +--echo # 16. A function changes non-trans-table. +--echo # +--echo # For row-based logging, there is an extra commit for the +--echo # non-transactional changes saved in the transaction cache to +--echo # the binary log. +--echo # +select f1(); +call p_verify_status_increment(0, 0, 1, 0); +commit; +call p_verify_status_increment(0, 0, 1, 0); + +--echo # 17. Read-only statement, a function changes non-trans-table. +--echo # +--echo # For row-based logging, there is an extra commit for the +--echo # non-transactional changes saved in the transaction cache to +--echo # the binary log. +--echo # +select f1() from t1; +call p_verify_status_increment(1, 0, 2, 0); +commit; +call p_verify_status_increment(1, 0, 2, 0); + +--echo # 18. Read-write statement: UPDATE, change 0 (transactional) rows. +--echo # +select count(*) from t2; +update t1 set a=2 where a=f1()+10; +select count(*) from t2; +call p_verify_status_increment(2, 0, 2, 0); +commit; +call p_verify_status_increment(2, 0, 2, 0); +--echo # +--echo # Replace the non-transactional table with a temporary +--echo # transactional table. Demonstrate that a change to a temporary +--echo # transactional table does not provoke 2-phase commit, although +--echo # does trigger a commit and a binlog write (in statement mode). +--echo # +drop table t2; +set sql_mode=no_engine_substitution; +create temporary table t2 (a int); +call p_verify_status_increment(0, 0, 0, 0); +set sql_mode=default; +--echo # 19. A function changes temp-trans-table. +--echo # +select f1(); +--echo # Two commits because a binary log record is written +call p_verify_status_increment(2, 0, 1, 0); +commit; +call p_verify_status_increment(2, 0, 1, 0); + +--echo # 20. Read-only statement, a function changes non-trans-table. +--echo # +select f1() from t1; +--echo # Two commits because a binary log record is written +call p_verify_status_increment(2, 0, 1, 0); +commit; +call p_verify_status_increment(2, 0, 1, 0); + +--echo # 21. Read-write statement: UPDATE, change 0 (transactional) rows. +--echo # +update t1 set a=2 where a=f1()+10; +call p_verify_status_increment(2, 0, 1, 0); +commit; +call p_verify_status_increment(2, 0, 1, 0); + +--echo # 22. DDL: ALTER TEMPORARY TABLE, should not cause a 2pc +--echo # +alter table t2 add column b int default 5; +--echo # A commit is done internally by ALTER. +call p_verify_status_increment(2, 0, 2, 0); +commit; +--echo # There is nothing left to commit +call p_verify_status_increment(0, 0, 0, 0); + +--echo # 23. DDL: RENAME TEMPORARY TABLE, does not start a transaction +--echo +--echo # No test because of Bug#8729 "rename table fails on temporary table" + +--echo # 24. DDL: TRUNCATE TEMPORARY TABLE, does not start a transaction +--echo +truncate table t2; +call p_verify_status_increment(2, 0, 2, 0); +commit; +--echo # There is nothing left to commit +call p_verify_status_increment(0, 0, 0, 0); + +--echo # 25. Read-write statement: unqualified DELETE +--echo +delete from t2; +call p_verify_status_increment(2, 0, 1, 0); +commit; +--echo # There is nothing left to commit +call p_verify_status_increment(2, 0, 1, 0); + +--echo # 25. DDL: DROP TEMPORARY TABLE, does not start a transaction +--echo # +drop temporary table t2; +call p_verify_status_increment(0, 0, 0, 0); +commit; +call p_verify_status_increment(0, 0, 0, 0); + +--echo # 26. Verify that SET AUTOCOMMIT issues an implicit commit +--echo # +insert t1 set a=3; +call p_verify_status_increment(2, 2, 2, 2); +set autocommit=1; +call p_verify_status_increment(2, 2, 2, 2); +rollback; +select a from t1 where a=3; +call p_verify_status_increment(1, 0, 1, 0); +delete from t1 where a=3; +call p_verify_status_increment(2, 2, 2, 2); +commit; +call p_verify_status_increment(0, 0, 0, 0); +set autocommit=0; +call p_verify_status_increment(0, 0, 0, 0); +insert t1 set a=3; +call p_verify_status_increment(2, 2, 2, 2); +--echo # Sic: not actually changing the value of autocommit +set autocommit=0; +call p_verify_status_increment(0, 0, 0, 0); +rollback; +select a from t1 where a=3; +call p_verify_status_increment(1, 0, 1, 0); + +--echo # 27. Savepoint management +--echo # +insert t1 set a=3; +call p_verify_status_increment(2, 2, 2, 2); +savepoint a; +call p_verify_status_increment(0, 0, 0, 0); +insert t1 set a=4; +--echo # Sic: a bug. Binlog did not register itself this time. +call p_verify_status_increment(1, 0, 1, 0); +release savepoint a; +rollback; +call p_verify_status_increment(0, 0, 0, 0); +select a from t1 where a=3; +call p_verify_status_increment(1, 0, 1, 0); +commit; +call p_verify_status_increment(1, 0, 1, 0); + +--echo # 28. Read-write statement: DO +--echo # +create table t2 (a int); +call p_verify_status_increment(0, 0, 0, 0); +do (select f1() from t1 where a=2); +call p_verify_status_increment(2, 2, 2, 2); +commit; +call p_verify_status_increment(2, 2, 2, 2); + +--echo # 29. Read-write statement: MULTI-DELETE +--echo # +delete t1, t2 from t1 join t2 on (t1.a=t2.a) where t1.a=2; +commit; +call p_verify_status_increment(4, 4, 4, 4); + +--echo # 30. Read-write statement: INSERT-SELECT, MULTI-UPDATE, REPLACE-SELECT +--echo # +insert into t2 select a from t1; +commit; +replace into t2 select a from t1; +commit; +call p_verify_status_increment(8, 8, 8, 8); +# +# Multi-update is one of the few remaining statements that still +# locks the tables at prepare step (and hence starts the transaction. +# Disable the PS protocol, since in this protocol we get a different +# number of commmits (there is an extra commit after prepare +# +--disable_ps_protocol +update t1, t2 set t1.a=4, t2.a=8 where t1.a=t2.a and t1.a=1; +--enable_ps_protocol +commit; +call p_verify_status_increment(4, 4, 4, 4); + +--echo # 31. DDL: various DDL with transactional tables +--echo # +--echo # Sic: no table is created. +create table if not exists t2 (a int) select 6 union select 7; +--echo # Sic: first commits the statement, and then the transaction. +call p_verify_status_increment(4, 4, 4, 4); +create table t3 select a from t2; +call p_verify_status_increment(4, 4, 4, 4); +alter table t3 add column (b int); +call p_verify_status_increment(2, 0, 2, 0); +alter table t3 rename t4; +call p_verify_status_increment(1, 0, 1, 0); +rename table t4 to t3; +call p_verify_status_increment(1, 0, 1, 0); +truncate table t3; +call p_verify_status_increment(2, 2, 2, 2); +create view v1 as select * from t2; +call p_verify_status_increment(1, 0, 1, 0); +check table t1; +call p_verify_status_increment(3, 0, 3, 0); +--echo # Sic: after this bug is fixed, CHECK leaves no pending transaction +commit; +call p_verify_status_increment(0, 0, 0, 0); +check table t1, t2, t3; +call p_verify_status_increment(6, 0, 6, 0); +commit; +call p_verify_status_increment(0, 0, 0, 0); +drop view v1; +call p_verify_status_increment(0, 0, 0, 0); + +--echo # +--echo # Cleanup +--echo # +drop table t1, t2, t3; +drop procedure p_verify_status_increment; +drop function f1; diff --git a/mysql-test/include/connect2.inc b/mysql-test/include/connect2.inc new file mode 100644 index 00000000000..6b830a909ed --- /dev/null +++ b/mysql-test/include/connect2.inc @@ -0,0 +1,56 @@ +# include/connect2.inc +# +# SUMMARY +# +# Make several attempts to connect. +# +# USAGE +# +# EXAMPLE +# +# connect.test +# + +--disable_query_log + +let $wait_counter= 300; +if ($wait_timeout) +{ + let $wait_counter= `SELECT $wait_timeout * 10`; +} +# Reset $wait_timeout so that its value won't be used on subsequent +# calls, and default will be used instead. +let $wait_timeout= 0; + +--echo # -- Establishing connection '$con_name' (user: $con_user_name)... + +while ($wait_counter) +{ + --disable_abort_on_error + --disable_result_log + --connect ($con_name,localhost,$con_user_name) + --enable_result_log + --enable_abort_on_error + + let $error = $mysql_errno; + + if (!$error) + { + let $wait_counter= 0; + } + if ($error) + { + real_sleep 0.1; + dec $wait_counter; + } +} +if ($error) +{ + --echo # -- Error: can not establish connection '$con_name'. +} +if (!$error) +{ + --echo # -- Connection '$con_name' has been established. +} + +--enable_query_log diff --git a/mysql-test/include/ctype_common.inc b/mysql-test/include/ctype_common.inc index 89b7ceb0c72..7d92c3c7b8f 100644 --- a/mysql-test/include/ctype_common.inc +++ b/mysql-test/include/ctype_common.inc @@ -13,6 +13,8 @@ SET @safe_character_set_server= @@character_set_server; SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; SET character_set_server= @test_character_set; SET collation_server= @test_collation; CREATE DATABASE d1; @@ -62,8 +64,22 @@ select a sounds like a from t1; select 1 from t1 order by cast(a as char(1)); drop table t1; +# +# Bug#27580 SPACE() function collation bug? +# +set names utf8; +create table t1 ( + name varchar(10), + level smallint unsigned); +show create table t1; +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +drop table t1; + DROP DATABASE d1; # Restore settings USE test; SET character_set_server= @safe_character_set_server; SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; diff --git a/mysql-test/include/ctype_german.inc b/mysql-test/include/ctype_german.inc new file mode 100644 index 00000000000..14d09358bea --- /dev/null +++ b/mysql-test/include/ctype_german.inc @@ -0,0 +1,40 @@ +# +# Bug #27877 incorrect german order in utf8_general_ci +# +# Testing if "SHARP S" is equal to "S", +# like in latin1_german1_ci, utf8_general_ci, ucs2_general_ci +# Or if "SHART S" is equal to "SS", +# like in latin1_german2_ci, utf8_unicode_ci, ucs2_unicode_ci +# +# Also testing A-uml, O-uml, U-uml +# + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# Create a table with a varchar(x) column, +# using current values of +# @@character_set_connection and @@collation_connection. +# + +create table t1 as select repeat(' ', 64) as s1; +select collation(s1) from t1; +delete from t1; + +# +# Populate data +# + +insert into t1 values ('a'),('ae'),(_latin1 0xE4); +insert into t1 values ('o'),('oe'),(_latin1 0xF6); +insert into t1 values ('s'),('ss'),(_latin1 0xDF); +insert into t1 values ('u'),('ue'),(_latin1 0xFC); + +# +# Check order +# +select s1, hex(s1) from t1 order by s1, binary s1; +select group_concat(s1 order by binary s1) from t1 group by s1; +drop table t1; diff --git a/mysql-test/include/ctype_like_range_f1f2.inc b/mysql-test/include/ctype_like_range_f1f2.inc new file mode 100644 index 00000000000..54ea1b4c665 --- /dev/null +++ b/mysql-test/include/ctype_like_range_f1f2.inc @@ -0,0 +1,25 @@ +# +# Bug#32510 LIKE search fails with indexed 'eucjpms' and 'ujis' char column +# +# Testing my_ctype_like_range_xxx +# (used in LIKE optimization for an indexed column) +# + +# Create table using @@character_set_connection and @@collation_connection +# for the string columns. + +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); + +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); + +# Check pattern (important for ucs2, utf16, utf32) +SELECT hex(concat(repeat(0xF1F2, 10), '%')); + +--echo 3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +DROP TABLE t1; diff --git a/mysql-test/include/ddl_i18n.check_views.inc b/mysql-test/include/ddl_i18n.check_views.inc index 727f3506e4a..db3ad02f459 100644 --- a/mysql-test/include/ddl_i18n.check_views.inc +++ b/mysql-test/include/ddl_i18n.check_views.inc @@ -9,6 +9,10 @@ SHOW CREATE VIEW v1| SHOW CREATE VIEW v2| +--echo + +SHOW CREATE VIEW v3| + # - Check INFORMATION_SCHEMA; --echo @@ -20,6 +24,10 @@ SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| +--echo + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| + # - Execute the views; --echo @@ -30,3 +38,7 @@ SELECT COLLATION(c1), COLLATION(c2) FROM v1| --echo SELECT COLLATION(c1) FROM v2| + +--echo + +SELECT * FROM v3| diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc new file mode 100644 index 00000000000..d15dd56b35d --- /dev/null +++ b/mysql-test/include/diff_tables.inc @@ -0,0 +1,122 @@ +# ==== Purpose ==== +# +# Check if the two given tables (possibly residing on different +# master/slave servers) are equal. +# +# ==== Usage ==== +# +# The tables to check are given by the test language variables +# $diff_table_1 and $diff_table_2. They must be of the +# following form: +# +# [master:|slave:]database.table +# +# I.e., both database and table must be speicified. Optionally, you +# can prefix the name with 'master:' (to read the table on master) or +# with 'slave:' (to read the table on slave). If no prefix is given, +# reads the table from the current connection. If one of these +# variables has a prefix, both should have a prefix. +# +# ==== Side effects ==== +# +# - Prints "Comparing tables $diff_table_1 and $diff_tables_2". +# +# - If the tables are different, prints the difference in a +# system-specific format (unified diff if supported) and generates +# an error. +# +# - If $diff_table_1 or $diff_table_2 begins with 'master:' or +# 'slave:', it will stay connected to one of those hosts after +# execution. The host is only guaranteed to remain unchanged if +# none of $diff_table_1 or $diff_table_2 begins with 'master:' or +# 'slave:'. +# +# ==== Bugs ==== +# +# - It is currently not possible to use this for tables that are +# supposed to be different, because if the files are different: +# - 'diff' produces system-dependent output, +# - the output includes the absolute path of the compared files, +# - the output includes a timestamp. +# To fix that, we'd probably have to use SQL to compute the +# symmetric difference between the tables. I'm not sure how to do +# that efficiently. If we implement this, it would be nice to +# compare the table definitions too. +# +# - It actually compares the result of "SELECT * FROM table ORDER BY +# col1, col2, ..., colN INTO OUTFILE 'file'". Hence, it is assumed +# that the comparison orders for both tables are equal and that two +# rows that are equal in the comparison order cannot differ, e.g., +# by character case. + + +# ==== Save both tables to file ==== + +--echo Comparing tables $diff_table_1 and $diff_table_2 +disable_query_log; + +--error 0,1 +--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_1 +--error 0,1 +--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2 + +let $_diff_table=$diff_table_2; +let $_diff_i=2; +while ($_diff_i) { + + # Parse out any leading "master:" or "slave:" from the table + # specification and connect the appropriate server. + let $_diff_conn_master=`SELECT SUBSTR('$_diff_table', 1, 7) = 'master:'`; + if ($_diff_conn_master) { + let $_diff_table=`SELECT SUBSTR('$_diff_table', 8)`; + connection master; + } + let $_diff_conn_slave=`SELECT SUBSTR('$_diff_table', 1, 6) = 'slave:'`; + if ($_diff_conn_slave) { + let $_diff_table=`SELECT SUBSTR('$_diff_table', 7)`; + connection slave; + } + + # Sanity-check the input. + let $_diff_error= `SELECT '$_diff_table' NOT LIKE '_%._%'`; + if ($_diff_error) { + --echo !!!ERROR IN TEST: \$diff_table_$_diff_i='$_diff_table' is not in the form database.table + exit; + } + + # We need the output files to be sorted (so that diff_files does not + # think the files are different just because they are differently + # ordered). To this end, we first generate a query that sorts the + # table by all columns. Since ORDER BY accept column indices, we + # just generate a comma-separated list of all numbers from 1 to the + # number of columns in the table. + let $_diff_column_index=`SELECT MAX(ordinal_position) + FROM information_schema.columns + WHERE CONCAT(table_schema, '.', table_name) = + '$_diff_table'`; + let $_diff_column_list=$_diff_column_index; + dec $_diff_column_index; + while ($_diff_column_index) { + let $_diff_column_list=$_diff_column_index, $_diff_column_list; + dec $_diff_column_index; + } + + # Now that we have the comma-separated list of columns, we can write + # the table to a file. + eval SELECT * FROM $_diff_table ORDER BY $_diff_column_list + INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/diff_table_$_diff_i'; + + # Do the same for $diff_table_1. + dec $_diff_i; + let $_diff_table=$diff_table_1; +} + + +# ==== Compare the generated files ==== + +diff_files $MYSQLTEST_VARDIR/tmp/diff_table_1 $MYSQLTEST_VARDIR/tmp/diff_table_2; + +--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_1 +--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2 + +enable_query_log; diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc index 703dfa44df0..a4cd6019be8 100644 --- a/mysql-test/include/mix1.inc +++ b/mysql-test/include/mix1.inc @@ -1090,6 +1090,19 @@ SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d; DROP TABLE t1; +# +# Bug #34223: Assertion failed: (optp->var_type & 127) == 8, +# file .\my_getopt.c, line 830 +# + +set @my_innodb_autoextend_increment=@@global.innodb_autoextend_increment; +set global innodb_autoextend_increment=8; +set global innodb_autoextend_increment=@my_innodb_autoextend_increment; + +set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency; +set global innodb_commit_concurrency=0; +set global innodb_commit_concurrency=@my_innodb_commit_concurrency; + --echo End of 5.0 tests # Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY @@ -1410,4 +1423,33 @@ SELECT * FROM t1 WHERE tid = 1 AND vid = 3 ORDER BY idx DESC; DROP TABLE t1; +# +# Bug#21704: Renaming column does not update FK definition. +# + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +--enable_warnings + +CREATE TABLE t1(id INT PRIMARY KEY) + ENGINE=innodb; + +CREATE TABLE t2( + t1_id INT PRIMARY KEY, + CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id)) + ENGINE=innodb; + +--echo + +--disable_result_log +--error ER_ERROR_ON_RENAME +ALTER TABLE t1 CHANGE id id2 INT; +--enable_result_log + +--echo + +DROP TABLE t2; +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/include/ndb_wait_connected.inc b/mysql-test/include/ndb_wait_connected.inc new file mode 100644 index 00000000000..cfea94db1f1 --- /dev/null +++ b/mysql-test/include/ndb_wait_connected.inc @@ -0,0 +1,26 @@ +# Check that mysqld has reconnected to ndbd after +# restart of ndbd +# +--disable_query_log +--disable_result_log +let $mysql_errno= 1; +let $counter= 600; +while ($mysql_errno) +{ + --error 0,157 + CREATE TABLE ndb_wait_connected (a int primary key); + if ($mysql_errno) + { + if (!$counter) + { + die Failed waiting for mysqld to reconnect to ndbd; + } + dec $counter; + --sleep 0.1 + } +} +DROP TABLE ndb_wait_connected; +--enable_query_log +--enable_result_log + + diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index fcdf84102aa..a80dc75df7d 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -1,4 +1,9 @@ ---let $binlog_start=106 +# $binlog_start can be set by caller or take a default value + +if (!$binlog_start) +{ + let $binlog_start=106; +} --replace_result $binlog_start --replace_column 2 # 4 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ diff --git a/mysql-test/include/wait_for_binlog_event.inc b/mysql-test/include/wait_for_binlog_event.inc new file mode 100644 index 00000000000..2a57c191413 --- /dev/null +++ b/mysql-test/include/wait_for_binlog_event.inc @@ -0,0 +1,33 @@ +# include/wait_for_binlog_event.inc +# +# SUMMARY +# +# Waits until SHOW BINLOG EVENTS has returned in last event a specified substring. +# +# USAGE +# +# let $wait_binlog_event= DROP; +# --source include/wait_for_binlog_event.inc + +let $_loop_count= 300; +let $_last_event= ; +let $_event_pos= 1; + +while (`SELECT INSTR("$_last_event","$wait_binlog_event") = 0`) +{ + dec $_loop_count; + if (!$_loop_count) + { + SHOW BINLOG EVENTS; + --die ERROR: failed while waiting for $wait_binlog_event in binlog + } + real_sleep 0.1; + let $_event= query_get_value(SHOW BINLOG EVENTS, Info, $_event_pos); + let $_last_event= $_event; + while (`SELECT "$_event" != "No such row"`) + { + inc $_event_pos; + let $_last_event= $_event; + let $_event= query_get_value(SHOW BINLOG EVENTS, Info, $_event_pos); + } +} diff --git a/mysql-test/include/wait_for_slave_sql_to_stop.inc b/mysql-test/include/wait_for_slave_sql_to_stop.inc index 7f435142901..cb5c437a586 100644 --- a/mysql-test/include/wait_for_slave_sql_to_stop.inc +++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc @@ -9,7 +9,10 @@ # sql threads to stop # 3) If loops too long die. #################################################### -connection slave; +if (!$keep_connection) +{ + connection slave; +} let $row_number= 1; let $run= 1; let $counter= 300; diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index d9ba9466482..2ca2669eb7f 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -889,6 +889,7 @@ our @tags= ["include/have_ndb.inc", "ndb_test", 1], ["include/have_multi_ndb.inc", "ndb_test", 1], ["include/have_ndb_extra.inc", "ndb_extra", 1], + ["include/ndb_master-slave.inc", "ndb_test", 1], ["require_manager", "require_manager", 1], ); diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index c911e20dad4..f4ee4dc7eed 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -279,6 +279,14 @@ sub mtr_report_stats ($) { /Failed to open log/ or /Failed to open the existing master info file/ or /Forcing shutdown of [0-9]* plugins/ or + /Can't open shared library .*\bha_example\b/ or + /Couldn't load plugin .*\bha_example\b/ or + + # Due to timing issues, it might be that this warning + # is printed when the server shuts down and the + # computer is loaded. + /Forcing close of thread \d+ user: '.*?'/ or + /Got error [0-9]* when reading table/ or /Incorrect definition of table/ or /Incorrect information in file/ or @@ -318,9 +326,9 @@ sub mtr_report_stats ($) { /Slave SQL:.*(?:Error_code: \d+|Query:.*)/ or /Sort aborted/ or /Time-out in NDB/ or - /Warning:\s+One can only use the --user.*root/ or - /Warning:\s+Setting lower_case_table_names=2/ or - /Warning:\s+Table:.* on (delete|rename)/ or + /One can only use the --user.*root/ or + /Setting lower_case_table_names=2/ or + /Table:.* on (delete|rename)/ or /You have an error in your SQL syntax/ or /deprecated/ or /description of time zone/ or @@ -382,11 +390,18 @@ sub mtr_report_stats ($) { $testname eq 'binlog.binlog_killed') and (/Failed to write to mysql\.\w+_log/ )) or - + + # rpl_bug33931 has deliberate failures + ($testname eq 'rpl.rpl_bug33931' and + (/Failed during slave.*thread initialization/ + )) or + # rpl_temporary has an error on slave that can be ignored ($testname eq 'rpl.rpl_temporary' and (/Slave: Can\'t find record in \'user\' Error_code: 1032/ )) or + # Test case for Bug#31590 produces the following error: + /Out of sort memory; increase server sort buffer size/ or # maria-recovery.test has warning about missing log file /File '.*maria_log.000.*' not found \(Errcode: 2\)/ or # and about marked-corrupted table diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index b65db0088b1..9a896039d60 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -62,6 +62,7 @@ use File::Path; use File::Basename; use File::Copy; use File::Temp qw /tempdir/; +use File::Spec::Functions qw /splitdir/; use Cwd; use Getopt::Long; use IO::Socket; @@ -134,14 +135,6 @@ our $default_vardir; our $opt_usage; our $opt_suites; our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb"; # Default suites to run -our @extra_suites= -( - ["mysql-5.1-new-ndb", "ndb_team"], - ["mysql-5.1-telco-6.2", "ndb_team"], - ["mysql-5.1-telco-6.3", "ndb_team"], -); - - our $opt_script_debug= 0; # Script debugging, enable with --script-debug our $opt_verbose= 0; # Verbose output, enable with --verbose @@ -412,14 +405,26 @@ sub main () { # Figure out which tests we are going to run if (!$opt_suites) { - # use default and add any extra_suites as defined $opt_suites= $opt_suites_default; - my $ddd= basename(dirname($glob_mysql_test_dir)); - foreach my $extra_suite (@extra_suites) + + # Check for any extra suites to enable based on the path name + my %extra_suites= + ( + "mysql-5.1-new-ndb" => "ndb_team", + "mysql-5.1-new-ndb-merge" => "ndb_team", + "mysql-5.1-telco-6.2" => "ndb_team", + "mysql-5.1-telco-6.2-merge" => "ndb_team", + "mysql-5.1-telco-6.3" => "ndb_team", + "mysql-6.0-ndb" => "ndb_team", + ); + + foreach my $dir ( reverse splitdir($glob_basedir) ) { - if ($extra_suite->[0] eq "$ddd") - { - $opt_suites= "$extra_suite->[1],$opt_suites"; + my $extra_suite= $extra_suites{$dir}; + if (defined $extra_suite){ + mtr_report("Found extra suite: $extra_suite"); + $opt_suites= "$extra_suite,$opt_suites"; + last; } } } @@ -3906,12 +3911,11 @@ sub mysqld_arguments ($$$$) { # When mysqld is run by a root user(euid is 0), it will fail - # to start unless we specify what user to run as. If not running - # as root it will be ignored, see BUG#30630 + # to start unless we specify what user to run as, see BUG#30630 my $euid= $>; if (!$glob_win32 and $euid == 0 and grep(/^--user/, @$extra_opt, @opt_extra_mysqld_opt) == 0) { - mtr_add_arg($args, "%s--user=root"); + mtr_add_arg($args, "%s--user=root", $prefix); } if ( $opt_valgrind_mysqld ) diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index b536d343615..37ec5314628 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -539,7 +539,7 @@ F2E5F1F2 drop table t1; create table t1 ( a timestamp ); alter table t1 add unique ( a(1) ); -ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys +ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys drop table t1; drop table if exists t1; create table t1 (a int, key(a)); @@ -953,12 +953,12 @@ t1 CREATE TABLE `t1` ( KEY `b_2` (`b`(50)) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CREATE TABLE t2 (a INT, KEY (a(20))); -ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys +ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys ALTER TABLE t1 ADD d INT; ALTER TABLE t1 ADD KEY (d(20)); -ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys +ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys ALTER TABLE t1 ADD e GEOMETRY NOT NULL, ADD SPATIAL KEY (e(30)); -ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys +ERROR HY000: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys DROP TABLE t1; CREATE TABLE t1 (s CHAR(8) BINARY); INSERT INTO t1 VALUES ('test'); diff --git a/mysql-test/r/binlog_index.result b/mysql-test/r/binlog_index.result new file mode 100644 index 00000000000..9f3c3746bd4 --- /dev/null +++ b/mysql-test/r/binlog_index.result @@ -0,0 +1,39 @@ +flush logs; +flush logs; +flush logs; +show binary logs; +Log_name File_size +master-bin.000001 # +master-bin.000002 # +master-bin.000003 # +master-bin.000004 # +purge binary logs TO 'master-bin.000004'; +Warnings: +Warning 1612 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found +*** must show a list starting from the 'TO' argument of PURGE *** +show binary logs; +Log_name File_size +master-bin.000004 # +reset master; +flush logs; +flush logs; +flush logs; +*** must be a warning master-bin.000001 was not found *** +Warnings: +Warning 1612 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found +*** must show one record, of the active binlog, left in the index file after PURGE *** +show binary logs; +Log_name File_size +master-bin.000004 # +reset master; +flush logs; +flush logs; +flush logs; +purge binary logs TO 'master-bin.000002'; +ERROR HY000: Fatal error during log purge +show warnings; +Level Code Message +Error 1377 a problem with deleting MYSQLTEST_VARDIR/log/master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files +Error 1377 Fatal error during log purge +reset master; +End of tests diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index d408a0b6153..0c0e2d623c8 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -27,7 +27,7 @@ explain extended select CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" E 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 (case 1 when 1 then _latin1'one' when 2 then _latin1'two' else _latin1'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END` +Note 1003 select (case 1 when 1 then 'one' when 2 then 'two' else 'more' end) AS `CASE 1 when 1 then "one" WHEN 2 then "two" ELSE "more" END` select CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END; CASE 2.0 when 1 then "one" WHEN 2.0 then "two" ELSE "more" END two @@ -147,7 +147,7 @@ COALESCE('a' COLLATE latin1_bin,'b'); 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 coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce(_latin1'a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,_latin1'1') AS `COALESCE(1,'1')`,coalesce(1.1,_latin1'1') AS `COALESCE(1.1,'1')`,coalesce((_latin1'a' collate latin1_bin),_latin1'b') AS `COALESCE('a' COLLATE latin1_bin,'b')` +Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce('a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,'1') AS `COALESCE(1,'1')`,coalesce(1.1,'1') AS `COALESCE(1.1,'1')`,coalesce(('a' collate latin1_bin),'b') AS `COALESCE('a' COLLATE latin1_bin,'b')` SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/r/change_user.result b/mysql-test/r/change_user.result index 12e86a08f8d..cb1e93f55d9 100644 --- a/mysql-test/r/change_user.result +++ b/mysql-test/r/change_user.result @@ -4,14 +4,14 @@ SELECT @@session.sql_big_selects; 1 SELECT @@global.max_join_size; @@global.max_join_size -18446744073709551615 +HA_POS_ERROR change_user SELECT @@session.sql_big_selects; @@session.sql_big_selects 1 SELECT @@global.max_join_size; @@global.max_join_size -18446744073709551615 +HA_POS_ERROR SET @@global.max_join_size = 10000; SET @@session.max_join_size = default; change_user diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result new file mode 100644 index 00000000000..a2c1eb9a82e --- /dev/null +++ b/mysql-test/r/commit_1innodb.result @@ -0,0 +1,892 @@ +set sql_mode=no_engine_substitution; +set storage_engine = InnoDB; +set autocommit=1; +drop table if exists t1; +drop table if exists t2; +drop table if exists t3; +drop function if exists f2; +drop procedure if exists bug12713_call; +drop procedure if exists bug12713_dump_spvars; +drop procedure if exists dummy; +create table t1 (a int); +create table t2 (a int unique); +create table t3 (a int); +set sql_mode=default; +insert into t1 (a) values (1), (2); +insert into t3 (a) values (1), (2); +create function f2(x int) returns int +begin +insert into t2 (a) values (x); +insert into t2 (a) values (x); +return x; +end| +set autocommit=0; +flush status; +insert into t2 (a) values (1001); +insert into t1 (a) values (f2(1)); +ERROR 23000: Duplicate entry '1' for key 'a' +select * from t2; +a +1001 +rollback; +select * from t2; +a +insert into t2 (a) values (1002); +insert into t3 (a) select f2(2) from t1; +ERROR 23000: Duplicate entry '2' for key 'a' +select * from t2; +a +1002 +rollback; +select * from t2; +a +insert into t2 (a) values (1003); +update t1 set a= a + f2(3); +ERROR 23000: Duplicate entry '3' for key 'a' +select * from t2; +a +1003 +rollback; +select * from t2; +a +insert into t2 (a) values (1004); +update t1, t3 set t1.a = 0, t3.a = 0 where (f2(4) = 4) and (t1.a = t3.a); +ERROR 23000: Duplicate entry '4' for key 'a' +select * from t2; +a +1004 +rollback; +select * from t2; +a +insert into t2 (a) values (1005); +delete from t1 where (a = f2(5)); +ERROR 23000: Duplicate entry '5' for key 'a' +select * from t2; +a +1005 +rollback; +select * from t2; +a +insert into t2 (a) values (1006); +delete from t1, t3 using t1, t3 where (f2(6) = 6) ; +ERROR 23000: Duplicate entry '6' for key 'a' +select * from t2; +a +1006 +rollback; +select * from t2; +a +insert into t2 (a) values (1007); +replace t1 values (f2(7)); +ERROR 23000: Duplicate entry '7' for key 'a' +select * from t2; +a +1007 +rollback; +select * from t2; +a +insert into t2 (a) values (1008); +replace into t3 (a) select f2(8) from t1; +ERROR 23000: Duplicate entry '8' for key 'a' +select * from t2; +a +1008 +rollback; +select * from t2; +a +insert into t2 (a) values (1009); +select f2(9) from t1 ; +ERROR 23000: Duplicate entry '9' for key 'a' +select * from t2; +a +1009 +rollback; +select * from t2; +a +insert into t2 (a) values (1010); +show databases where (f2(10) = 10); +ERROR 23000: Duplicate entry '10' for key 'a' +select * from t2; +a +1010 +rollback; +select * from t2; +a +insert into t2 (a) values (1011); +show tables where (f2(11) = 11); +ERROR 23000: Duplicate entry '11' for key 'a' +select * from t2; +a +1011 +rollback; +select * from t2; +a +insert into t2 (a) values (1012); +show triggers where (f2(12) = 12); +ERROR 23000: Duplicate entry '12' for key 'a' +select * from t2; +a +1012 +rollback; +select * from t2; +a +insert into t2 (a) values (1013); +show table status where (f2(13) = 13); +ERROR 23000: Duplicate entry '13' for key 'a' +select * from t2; +a +1013 +rollback; +select * from t2; +a +insert into t2 (a) values (1014); +show open tables where (f2(14) = 14); +ERROR 23000: Duplicate entry '14' for key 'a' +select * from t2; +a +1014 +rollback; +select * from t2; +a +insert into t2 (a) values (1015); +show columns in mysql.proc where (f2(15) = 15); +ERROR 23000: Duplicate entry '15' for key 'a' +select * from t2; +a +1015 +rollback; +select * from t2; +a +insert into t2 (a) values (1016); +show status where (f2(16) = 16); +ERROR 23000: Duplicate entry '16' for key 'a' +select * from t2; +a +1016 +rollback; +select * from t2; +a +insert into t2 (a) values (1017); +show variables where (f2(17) = 17); +ERROR 23000: Duplicate entry '17' for key 'a' +select * from t2; +a +1017 +rollback; +select * from t2; +a +insert into t2 (a) values (1018); +show charset where (f2(18) = 18); +ERROR 23000: Duplicate entry '18' for key 'a' +select * from t2; +a +1018 +rollback; +select * from t2; +a +insert into t2 (a) values (1019); +show collation where (f2(19) = 19); +ERROR 23000: Duplicate entry '19' for key 'a' +select * from t2; +a +1019 +rollback; +select * from t2; +a +# We need at least one procedure to make sure the WHERE clause is +# evaluated +create procedure dummy() begin end; +insert into t2 (a) values (1020); +show procedure status where (f2(20) = 20); +ERROR 23000: Duplicate entry '20' for key 'a' +select * from t2; +a +1020 +rollback; +select * from t2; +a +drop procedure dummy; +insert into t2 (a) values (1021); +show function status where (f2(21) = 21); +ERROR 23000: Duplicate entry '21' for key 'a' +select * from t2; +a +1021 +rollback; +select * from t2; +a +insert into t2 (a) values (1022); +prepare stmt from "insert into t1 (a) values (f2(22))"; +execute stmt; +ERROR 23000: Duplicate entry '22' for key 'a' +select * from t2; +a +1022 +rollback; +select * from t2; +a +insert into t2 (a) values (1023); +do (f2(23)); +Warnings: +Error 1062 Duplicate entry '23' for key 'a' +select * from t2; +a +1023 +rollback; +select * from t2; +a +create procedure bug12713_call () +begin +insert into t2 (a) values (24); +insert into t2 (a) values (24); +end| +insert into t2 (a) values (1024); +call bug12713_call(); +ERROR 23000: Duplicate entry '24' for key 'a' +select * from t2; +a +24 +1024 +rollback; +select * from t2; +a +======================================================================= +Testing select_to_file +======================================================================= +insert into t2 (a) values (1025); +select f2(25) into outfile "../tmp/dml.out" from t1; +ERROR 23000: Duplicate entry '25' for key 'a' +select * from t2; +a +1025 +rollback; +select * from t2; +a +insert into t2 (a) values (1026); +load data infile "../std_data_ln/words.dat" into table t1 (a) set a:=f2(26); +ERROR 23000: Duplicate entry '26' for key 'a' +select * from t2; +a +1026 +rollback; +select * from t2; +a +======================================================================= +Testing select_dumpvar +======================================================================= +insert into t2 (a) values (1027); +select f2(27) into @foo; +ERROR 23000: Duplicate entry '27' for key 'a' +select * from t2; +a +1027 +rollback; +select * from t2; +a +======================================================================= +Testing Select_fetch_into_spvars +======================================================================= +create procedure bug12713_dump_spvars () +begin +declare foo int; +declare continue handler for sqlexception +begin +select "Exception trapped"; +end; +select f2(28) into foo; +select * from t2; +end| +insert into t2 (a) values (1028); +call bug12713_dump_spvars (); +Exception trapped +Exception trapped +a +1028 +rollback; +select * from t2; +a +======================================================================= +Cleanup +======================================================================= +set autocommit=default; +drop table t1; +drop table t2; +drop table t3; +drop function f2; +drop procedure bug12713_call; +drop procedure bug12713_dump_spvars; +# +# Bug#12713 Error in a stored function called from a SELECT doesn't +# cause ROLLBACK of statem +# +# Verify that two-phase commit is not issued for read-only +# transactions. +# +# Verify that two-phase commit is issued for read-write transactions, +# even if the change is done inside a stored function called from +# SELECT or SHOW statement. +# +set autocommit=0; +drop table if exists t1; +drop table if exists t2; +drop function if exists f1; +drop procedure if exists p_verify_status_increment; +set @binlog_format=@@global.binlog_format; +set sql_mode=no_engine_substitution; +create table t1 (a int unique); +create table t2 (a int) engine=myisam; +set sql_mode=default; +# +# An auxiliary procedure to track Handler_prepare and Handler_commit +# statistics. +# +create procedure +p_verify_status_increment(commit_inc_mixed int, prepare_inc_mixed int, +commit_inc_row int, prepare_inc_row int) +begin +declare commit_inc int; +declare prepare_inc int; +declare old_commit_count int default ifnull(@commit_count, 0); +declare old_prepare_count int default ifnull(@prepare_count, 0); +declare c_res int; +# Use a cursor to have just one access to I_S instead of 2, it is very slow +# and amounts for over 90% of test CPU time +declare c cursor for +select variable_value +from information_schema.session_status +where variable_name='Handler_commit' or variable_name='Handler_prepare' + order by variable_name; +if @binlog_format = 'ROW' then +set commit_inc= commit_inc_row; +set prepare_inc= prepare_inc_row; +else +set commit_inc= commit_inc_mixed; +set prepare_inc= prepare_inc_mixed; +end if; +open c; +fetch c into c_res; +set @commit_count=c_res; +fetch c into c_res; +set @prepare_count=c_res; +close c; +if old_commit_count + commit_inc <> @commit_count then +select concat("Expected commit increment: ", commit_inc, +" actual: ", @commit_count - old_commit_count) +as 'ERROR'; +elseif old_prepare_count + prepare_inc <> @prepare_count then +select concat("Expected prepare increment: ", prepare_inc, +" actual: ", @prepare_count - old_prepare_count) +as 'ERROR'; +else +select '' as 'SUCCESS'; +end if; +end| +# Reset Handler_commit and Handler_prepare counters +flush status; +# +# 1. Read-only statement: SELECT +# +select * from t1; +a +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +# 2. Read-write statement: INSERT, insert 1 row. +# +insert into t1 (a) values (1); +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +commit; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +# 3. Read-write statement: UPDATE, update 1 row. +# +update t1 set a=2; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +commit; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +# 4. Read-write statement: UPDATE, update 0 rows, 1 row matches WHERE +# +update t1 set a=2; +call p_verify_status_increment(2, 2, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(2, 2, 1, 0); +SUCCESS + +# 5. Read-write statement: UPDATE, update 0 rows, 0 rows match WHERE +# +# In mixed replication mode, there is a read-only transaction +# in InnoDB and also the statement is written to the binary log. +# So we have two commits but no 2pc, since the first engine's +# transaction is read-only. +# In the row level replication mode, we only have the read-only +# transaction in InnoDB and nothing is written to the binary log. +# +update t1 set a=3 where a=1; +call p_verify_status_increment(2, 0, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(2, 0, 1, 0); +SUCCESS + +# 6. Read-write statement: DELETE, delete 0 rows. +# +delete from t1 where a=1; +call p_verify_status_increment(2, 0, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(2, 0, 1, 0); +SUCCESS + +# 7. Read-write statement: DELETE, delete 1 row. +# +delete from t1 where a=2; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +commit; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +# 8. Read-write statement: unqualified DELETE +# +# In statement or mixed replication mode, we call +# handler::ha_delete_all_rows() and write statement text +# to the binary log. This results in two read-write transactions. +# In row level replication mode, we do not call +# handler::ha_delete_all_rows(), but delete rows one by one. +# Since there are no rows, nothing is written to the binary log. +# Thus we have just one read-only transaction in InnoDB. +delete from t1; +call p_verify_status_increment(2, 2, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(2, 2, 1, 0); +SUCCESS + +# 9. Read-write statement: REPLACE, change 1 row. +# +replace t1 set a=1; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +commit; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +# 10. Read-write statement: REPLACE, change 0 rows. +# +replace t1 set a=1; +call p_verify_status_increment(2, 2, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(2, 2, 1, 0); +SUCCESS + +# 11. Read-write statement: IODKU, change 1 row. +# +insert t1 set a=1 on duplicate key update a=a+1; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +select * from t1; +a +2 +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +# 12. Read-write statement: IODKU, change 0 rows. +# +insert t1 set a=2 on duplicate key update a=2; +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +# 13. Read-write statement: INSERT IGNORE, change 0 rows. +# +insert ignore t1 set a=2; +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +# 14. Read-write statement: INSERT IGNORE, change 1 row. +# +insert ignore t1 set a=1; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +commit; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +# 15. Read-write statement: UPDATE IGNORE, change 0 rows. +# +update ignore t1 set a=2 where a=1; +call p_verify_status_increment(2, 2, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(2, 2, 1, 0); +SUCCESS + +# +# Create a stored function that modifies a +# non-transactional table. Demonstrate that changes in +# non-transactional tables do not affect the two phase commit +# algorithm. +# +create function f1() returns int +begin +insert t2 set a=2; +return 2; +end| +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +# 16. A function changes non-trans-table. +# +# For row-based logging, there is an extra commit for the +# non-transactional changes saved in the transaction cache to +# the binary log. +# +select f1(); +f1() +2 +call p_verify_status_increment(0, 0, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(0, 0, 1, 0); +SUCCESS + +# 17. Read-only statement, a function changes non-trans-table. +# +# For row-based logging, there is an extra commit for the +# non-transactional changes saved in the transaction cache to +# the binary log. +# +select f1() from t1; +f1() +2 +2 +call p_verify_status_increment(1, 0, 2, 0); +SUCCESS + +commit; +call p_verify_status_increment(1, 0, 2, 0); +SUCCESS + +# 18. Read-write statement: UPDATE, change 0 (transactional) rows. +# +select count(*) from t2; +count(*) +3 +update t1 set a=2 where a=f1()+10; +select count(*) from t2; +count(*) +5 +call p_verify_status_increment(2, 0, 2, 0); +SUCCESS + +commit; +call p_verify_status_increment(2, 0, 2, 0); +SUCCESS + +# +# Replace the non-transactional table with a temporary +# transactional table. Demonstrate that a change to a temporary +# transactional table does not provoke 2-phase commit, although +# does trigger a commit and a binlog write (in statement mode). +# +drop table t2; +set sql_mode=no_engine_substitution; +create temporary table t2 (a int); +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +set sql_mode=default; +# 19. A function changes temp-trans-table. +# +select f1(); +f1() +2 +# Two commits because a binary log record is written +call p_verify_status_increment(2, 0, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(2, 0, 1, 0); +SUCCESS + +# 20. Read-only statement, a function changes non-trans-table. +# +select f1() from t1; +f1() +2 +2 +# Two commits because a binary log record is written +call p_verify_status_increment(2, 0, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(2, 0, 1, 0); +SUCCESS + +# 21. Read-write statement: UPDATE, change 0 (transactional) rows. +# +update t1 set a=2 where a=f1()+10; +call p_verify_status_increment(2, 0, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(2, 0, 1, 0); +SUCCESS + +# 22. DDL: ALTER TEMPORARY TABLE, should not cause a 2pc +# +alter table t2 add column b int default 5; +# A commit is done internally by ALTER. +call p_verify_status_increment(2, 0, 2, 0); +SUCCESS + +commit; +# There is nothing left to commit +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +# 23. DDL: RENAME TEMPORARY TABLE, does not start a transaction + +# No test because of Bug#8729 "rename table fails on temporary table" +# 24. DDL: TRUNCATE TEMPORARY TABLE, does not start a transaction + +truncate table t2; +call p_verify_status_increment(2, 0, 2, 0); +SUCCESS + +commit; +# There is nothing left to commit +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +# 25. Read-write statement: unqualified DELETE + +delete from t2; +call p_verify_status_increment(2, 0, 1, 0); +SUCCESS + +commit; +# There is nothing left to commit +call p_verify_status_increment(2, 0, 1, 0); +SUCCESS + +# 25. DDL: DROP TEMPORARY TABLE, does not start a transaction +# +drop temporary table t2; +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +commit; +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +# 26. Verify that SET AUTOCOMMIT issues an implicit commit +# +insert t1 set a=3; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +set autocommit=1; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +rollback; +select a from t1 where a=3; +a +3 +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +delete from t1 where a=3; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +commit; +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +set autocommit=0; +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +insert t1 set a=3; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +# Sic: not actually changing the value of autocommit +set autocommit=0; +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +rollback; +select a from t1 where a=3; +a +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +# 27. Savepoint management +# +insert t1 set a=3; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +savepoint a; +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +insert t1 set a=4; +# Sic: a bug. Binlog did not register itself this time. +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +release savepoint a; +rollback; +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +select a from t1 where a=3; +a +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +commit; +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +# 28. Read-write statement: DO +# +create table t2 (a int); +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +do (select f1() from t1 where a=2); +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +commit; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +# 29. Read-write statement: MULTI-DELETE +# +delete t1, t2 from t1 join t2 on (t1.a=t2.a) where t1.a=2; +commit; +call p_verify_status_increment(4, 4, 4, 4); +SUCCESS + +# 30. Read-write statement: INSERT-SELECT, MULTI-UPDATE, REPLACE-SELECT +# +insert into t2 select a from t1; +commit; +replace into t2 select a from t1; +commit; +call p_verify_status_increment(8, 8, 8, 8); +SUCCESS + +update t1, t2 set t1.a=4, t2.a=8 where t1.a=t2.a and t1.a=1; +commit; +call p_verify_status_increment(4, 4, 4, 4); +SUCCESS + +# 31. DDL: various DDL with transactional tables +# +# Sic: no table is created. +create table if not exists t2 (a int) select 6 union select 7; +Warnings: +Note 1050 Table 't2' already exists +# Sic: first commits the statement, and then the transaction. +call p_verify_status_increment(4, 4, 4, 4); +SUCCESS + +create table t3 select a from t2; +call p_verify_status_increment(4, 4, 4, 4); +SUCCESS + +alter table t3 add column (b int); +call p_verify_status_increment(2, 0, 2, 0); +SUCCESS + +alter table t3 rename t4; +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +rename table t4 to t3; +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +truncate table t3; +call p_verify_status_increment(2, 2, 2, 2); +SUCCESS + +create view v1 as select * from t2; +call p_verify_status_increment(1, 0, 1, 0); +SUCCESS + +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +call p_verify_status_increment(3, 0, 3, 0); +SUCCESS + +# Sic: after this bug is fixed, CHECK leaves no pending transaction +commit; +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +check table t1, t2, t3; +Table Op Msg_type Msg_text +test.t1 check status OK +test.t2 check status OK +test.t3 check status OK +call p_verify_status_increment(6, 0, 6, 0); +SUCCESS + +commit; +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +drop view v1; +call p_verify_status_increment(0, 0, 0, 0); +SUCCESS + +# +# Cleanup +# +drop table t1, t2, t3; +drop procedure p_verify_status_increment; +drop function f1; diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result index c141b255716..44c258d7611 100644 --- a/mysql-test/r/compare.result +++ b/mysql-test/r/compare.result @@ -53,3 +53,41 @@ a b Warnings: Warning 1292 Truncated incorrect DOUBLE value: '' drop table if exists t1; +CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill); +INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2); +SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1; +CONCAT(b,c) CONCAT(b,c) = '0101' +0102 0 +0101 1 +0202 0 +EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 1) and (concat('01',`test`.`t1`.`c`) = '0101')) +SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101'; +b c +01 01 +CREATE TABLE t2 (a int); +INSERT INTO t2 VALUES (1),(2); +SELECT a, +(SELECT COUNT(*) FROM t1 +WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x +FROM t2 ORDER BY a; +a x +1 1 +2 0 +EXPLAIN EXTENDED +SELECT a, +(SELECT COUNT(*) FROM t1 +WHERE b = t2.a AND CONCAT(b,c) = CONCAT('0',t2.a,'01')) x +FROM t2 ORDER BY a; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using filesort +2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 +Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1 +Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) AS `COUNT(*)` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a` +DROP TABLE t1,t2; +End of 5.0 tests diff --git a/mysql-test/r/compress.result b/mysql-test/r/compress.result index a71d840d229..1d3752f09e7 100644 --- a/mysql-test/r/compress.result +++ b/mysql-test/r/compress.result @@ -1511,7 +1511,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1'')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index 25cf4f90e6d..727433d3032 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -115,3 +115,106 @@ create temporary table t2(id integer not null auto_increment primary key); set @id := 1; delete from t1 where id like @id; drop table t1; +# ------------------------------------------------------------------ +# -- End of 4.1 tests +# ------------------------------------------------------------------ + +# -- Bug#33507: Event scheduler creates more threads than max_connections +# -- which results in user lockout. + +GRANT USAGE ON *.* TO mysqltest_u1@localhost; + +SET GLOBAL max_connections = 3; +SET GLOBAL event_scheduler = ON; + +# -- Waiting for Event Scheduler to start... + +# -- Disconnecting default connection... + +# -- Check that we allow exactly three user connections, no matter how +# -- many threads are running. + +# -- Connecting (1)... +# -- Establishing connection 'con_1' (user: mysqltest_u1)... +# -- Connection 'con_1' has been established. + +# -- Connecting (2)... +# -- Establishing connection 'con_2' (user: mysqltest_u1)... +# -- Connection 'con_2' has been established. + +# -- Connecting (3)... +# -- Establishing connection 'con_3' (user: mysqltest_u1)... +# -- Connection 'con_3' has been established. + +# -- Connecting (4) [should fail]... +# -- Establishing connection 'con_4' (user: mysqltest_u1)... +# -- Error: can not establish connection 'con_4'. + +# -- Check that we allow one extra SUPER-user connection. + +# -- Connecting super (1)... +# -- Establishing connection 'con_super_1' (user: root)... +# -- Connection 'con_super_1' has been established. + +# -- Connecting super (2) [should fail]... +# -- Establishing connection 'con_super_2' (user: root)... +# -- Error: can not establish connection 'con_super_2'. + +# -- Ensure that we have Event Scheduler thread, 3 ordinary user +# -- connections and one extra super-user connection. +SELECT user FROM information_schema.processlist ORDER BY id; +user +event_scheduler +mysqltest_u1 +mysqltest_u1 +mysqltest_u1 +root + +# -- Resetting variables... +SET GLOBAL max_connections = 151; + +# -- Stopping Event Scheduler... +SET GLOBAL event_scheduler = OFF; + +# -- Waiting for Event Scheduler to stop... + +# -- That's it. Closing connections... + +# -- Restoring default connection... + +# -- Waiting for connections to close... + +DROP USER mysqltest_u1@localhost; + +# -- End of Bug#33507. + +# -- Bug#35074: max_used_connections is not correct. + +FLUSH STATUS; + +SHOW STATUS LIKE 'max_used_connections'; +Variable_name Value +Max_used_connections 1 + +# -- Starting Event Scheduler... +SET GLOBAL event_scheduler = ON; +# -- Waiting for Event Scheduler to start... + +# -- Opening a new connection to check max_used_connections... + +# -- Check that max_used_connections hasn't changed. +SHOW STATUS LIKE 'max_used_connections'; +Variable_name Value +Max_used_connections 2 + +# -- Closing new connection... + +# -- Stopping Event Scheduler... +SET GLOBAL event_scheduler = OFF; +# -- Waiting for Event Scheduler to stop... + +# -- End of Bug#35074. + +# ------------------------------------------------------------------ +# -- End of 5.1 tests +# ------------------------------------------------------------------ diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 73731ead70b..79f3bd4691f 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1545,6 +1545,20 @@ Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next 7 drop table t1,t2; +CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1)); +DROP TABLE t1; +CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE); +DROP TABLE t1; +CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY; +SHOW INDEX FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 c1 1 c1 NULL 0 NULL NULL YES HASH +DROP TABLE t1; +CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY; +SHOW INDEX FROM t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 c1 1 c1 A NULL NULL NULL YES BTREE +DROP TABLE t1; End of 5.0 tests CREATE TABLE t1 (a int, b int); insert into t1 values (1,1),(1,2); @@ -1743,4 +1757,135 @@ t1 CREATE TABLE `t1` ( `MAXLEN` bigint(3) NOT NULL DEFAULT '0' ) ENGINE=MEMORY DEFAULT CHARSET=utf8 drop table t1; + +# -- +# -- Bug#21380: DEFAULT definition not always transfered by CREATE +# -- TABLE/SELECT to the new table. +# -- + +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; + +CREATE TABLE t1( +c1 INT DEFAULT 12 COMMENT 'column1', +c2 INT NULL COMMENT 'column2', +c3 INT NOT NULL COMMENT 'column3', +c4 VARCHAR(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a', +c5 VARCHAR(255) COLLATE utf8_unicode_ci NULL DEFAULT 'b', +c6 VARCHAR(255)) +COLLATE latin1_bin; + +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT '12' COMMENT 'column1', + `c2` int(11) DEFAULT NULL COMMENT 'column2', + `c3` int(11) NOT NULL COMMENT 'column3', + `c4` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a', + `c5` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'b', + `c6` varchar(255) COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin + +CREATE TABLE t2 AS SELECT * FROM t1; + +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `c1` int(11) DEFAULT '12' COMMENT 'column1', + `c2` int(11) DEFAULT NULL COMMENT 'column2', + `c3` int(11) NOT NULL COMMENT 'column3', + `c4` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a', + `c5` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'b', + `c6` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +DROP TABLE t2; + +# -- End of test case for Bug#21380. + +# -- +# -- Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields +# -- + +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +DROP TABLE IF EXISTS t3; + +CREATE TABLE t1(c1 TIMESTAMP, c2 TIMESTAMP); + +SET sql_mode = NO_ZERO_DATE; + +CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP DEFAULT 0); +ERROR 42000: Invalid default value for 'c2' + +CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP); +ERROR 42000: Invalid default value for 'c2' + +# -- Check that NULL column still can be created. +CREATE TABLE t2(c1 TIMESTAMP NULL); + +# -- Check ALTER TABLE. +ALTER TABLE t1 ADD INDEX(c1); +ERROR 42000: Invalid default value for 'c2' + +# -- Check DATETIME. +SET sql_mode = ''; + +CREATE TABLE t3(c1 DATETIME NOT NULL); +INSERT INTO t3 VALUES (0); + +SET sql_mode = TRADITIONAL; + +ALTER TABLE t3 ADD INDEX(c1); +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'c1' at row 1 + +# -- Cleanup. +SET sql_mode = ''; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; + +# -- End of Bug#18834. + +# -- +# -- Bug#34274: Invalid handling of 'DEFAULT 0' for YEAR data type. +# -- + +DROP TABLE IF EXISTS t1; + +CREATE TABLE t1(c1 YEAR DEFAULT 2008, c2 YEAR DEFAULT 0); + +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` year(4) DEFAULT '2008', + `c2` year(4) DEFAULT '0000' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +INSERT INTO t1 VALUES(); + +SELECT * FROM t1; +c1 c2 +2008 0000 + +ALTER TABLE t1 MODIFY c1 YEAR DEFAULT 0; + +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` year(4) DEFAULT '0000', + `c2` year(4) DEFAULT '0000' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + +INSERT INTO t1 VALUES(); + +SELECT * FROM t1; +c1 c2 +2008 0000 +0000 0000 + +DROP TABLE t1; + +# -- End of Bug#34274 + End of 5.1 tests diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index b0033383f00..b91272f7e59 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5379,4 +5379,13 @@ SHOW WARNINGS; Level Code Message Error 1178 The storage engine for the table doesn't support nullable columns Error 1005 Can't create table 'test.t1' (errno: 138) +create table t1 (c1 tinyblob not null) engine=csv; +insert into t1 values("This"); +update t1 set c1="That" where c1="This"; +affected rows: 1 +info: Rows matched: 1 Changed: 1 Warnings: 0 +select * from t1; +c1 +That +drop table t1; End of 5.1 tests diff --git a/mysql-test/r/csv_not_null.result b/mysql-test/r/csv_not_null.result new file mode 100644 index 00000000000..77026b8f056 --- /dev/null +++ b/mysql-test/r/csv_not_null.result @@ -0,0 +1,53 @@ +# ===== csv_not_null.1 ===== +DROP TABLE IF EXISTS t1, t2; +# === Will fail -- no NOT NULL === +CREATE TABLE t1 (a int) ENGINE = CSV; +ERROR 42000: The storage engine for the table doesn't support nullable columns +# === Good CREATE === +CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV; +# === Will fail -- ALL columns need NOT NULL == +CREATE TABLE t2 (a int NOT NULL, b char(20)) ENGINE = CSV; +ERROR 42000: The storage engine for the table doesn't support nullable columns +DROP TABLE t1; +# ===== csv_not_null.2 ===== +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a int NOT NULL, b blob NOT NULL, c CHAR(20) NOT NULL, +d VARCHAR(20) NOT NULL, e enum('foo','bar') NOT NULL,f DATE NOT NULL) +ENGINE = CSV; +# === should result in default for each datatype === +INSERT INTO t1 VALUES(); +SELECT * FROM t1; +a b c d e f +0 foo 0000-00-00 +SELECT * FROM t1; +a b c d e f +0 foo 0000-00-00 +INSERT INTO t1 VALUES(0,'abc','def','ghi','bar','1999-12-31'); +SELECT * FROM t1; +a b c d e f +0 foo 0000-00-00 +0 abc def ghi bar 1999-12-31 +# === insert failures === +INSERT INTO t1 VALUES(NULL,'ab','a','b','foo','2007-01-01'); +ERROR 23000: Column 'a' cannot be null +INSERT INTO t1 VALUES(default(a),default(b), default(c), default(d), +default(e), default(f)); +ERROR HY000: Field 'a' doesn't have a default value +DROP TABLE t1; +# ===== csv_not_null.3 ===== +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a int NOT NULL, b char(10) NOT NULL) ENGINE = CSV; +INSERT INTO t1 VALUES(); +SELECT * FROM t1; +a b +0 +UPDATE t1 set b = 'new_value' where a = 0; +SELECT * FROM t1; +a b +0 new_value +UPDATE t1 set b = NULL where b = 'new_value'; +ERROR 23000: Column 'b' cannot be null +SELECT * FROM t1; +a b +0 new_value +DROP TABLE t1; diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result index 8103e9b856f..2c8059a8afc 100644 --- a/mysql-test/r/ctype_big5.result +++ b/mysql-test/r/ctype_big5.result @@ -3,6 +3,8 @@ SET @test_character_set= 'big5'; SET @test_collation= 'big5_chinese_ci'; SET @safe_character_set_server= @@character_set_server; SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; SET character_set_server= @test_character_set; SET collation_server= @test_collation; CREATE DATABASE d1; @@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=big5 +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; DROP DATABASE d1; USE test; SET character_set_server= @safe_character_set_server; SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; SET NAMES big5; SET collation_connection='big5_chinese_ci'; create table t1 select repeat('a',4000) a; @@ -124,6 +143,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET collation_connection='big5_bin'; create table t1 select repeat('a',4000) a; delete from t1; @@ -174,6 +210,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET NAMES big5; CREATE TABLE t1 (a text) character set big5; INSERT INTO t1 VALUES ('ùØ'); diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index 026c0ebdcf2..69b48ee2952 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -519,7 +519,7 @@ explain extended SELECT charset('a'),collation('a'),coercibility('a'),'a'='A'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select charset(_latin1'a') AS `charset('a')`,collation(_latin1'a') AS `collation('a')`,coercibility(_latin1'a') AS `coercibility('a')`,(_latin1'a' = _latin1'A') AS `'a'='A'` +Note 1003 select charset('a') AS `charset('a')`,collation('a') AS `collation('a')`,coercibility('a') AS `coercibility('a')`,('a' = 'A') AS `'a'='A'` SET CHARACTER SET koi8r; SHOW VARIABLES LIKE 'collation_client'; Variable_name Value diff --git a/mysql-test/r/ctype_cp1250_ch.result b/mysql-test/r/ctype_cp1250_ch.result index 4b02fa2182a..7f0cdf3f17b 100644 --- a/mysql-test/r/ctype_cp1250_ch.result +++ b/mysql-test/r/ctype_cp1250_ch.result @@ -3,6 +3,192 @@ DROP TABLE IF EXISTS t1; SHOW COLLATION LIKE 'cp1250_czech_cs'; Collation Charset Id Default Compiled Sortlen cp1250_czech_cs cp1250 34 Yes 2 +SET @test_character_set= 'cp1250'; +SET @test_collation= 'cp1250_general_ci'; +SET @safe_character_set_server= @@character_set_server; +SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; +SET character_set_server= @test_character_set; +SET collation_server= @test_collation; +CREATE DATABASE d1; +USE d1; +CREATE TABLE t1 (c CHAR(10), KEY(c)); +SHOW FULL COLUMNS FROM t1; +Field Type Collation Null Key Default Extra Privileges Comment +c char(10) cp1250_general_ci YES MUL NULL +INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa'); +SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%'; +want3results +aaa +aaaa +aaaaa +DROP TABLE t1; +CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2))); +SHOW FULL COLUMNS FROM t1; +Field Type Collation Null Key Default Extra Privileges Comment +c1 varchar(15) cp1250_general_ci YES MUL NULL +INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab'); +SELECT c1 as want3results from t1 where c1 like 'l%'; +want3results +location +loberge +lotre +SELECT c1 as want3results from t1 where c1 like 'lo%'; +want3results +location +loberge +lotre +SELECT c1 as want1result from t1 where c1 like 'loc%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'loca%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'locat%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'locati%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'locatio%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'location%'; +want1result +location +DROP TABLE t1; +create table t1 (a set('a') not null); +insert into t1 values (),(); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +select cast(a as char(1)) from t1; +cast(a as char(1)) + + +select a sounds like a from t1; +a sounds like a +1 +1 +select 1 from t1 order by cast(a as char(1)); +1 +1 +1 +drop table t1; +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp1250 +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; +DROP DATABASE d1; +USE test; +SET character_set_server= @safe_character_set_server; +SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; +SET @test_character_set= 'cp1250'; +SET @test_collation= 'cp1250_czech_cs'; +SET @safe_character_set_server= @@character_set_server; +SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; +SET character_set_server= @test_character_set; +SET collation_server= @test_collation; +CREATE DATABASE d1; +USE d1; +CREATE TABLE t1 (c CHAR(10), KEY(c)); +SHOW FULL COLUMNS FROM t1; +Field Type Collation Null Key Default Extra Privileges Comment +c char(10) cp1250_czech_cs YES MUL NULL +INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa'); +SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%'; +want3results +aaa +aaaa +aaaaa +DROP TABLE t1; +CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2))); +SHOW FULL COLUMNS FROM t1; +Field Type Collation Null Key Default Extra Privileges Comment +c1 varchar(15) cp1250_czech_cs YES MUL NULL +INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab'); +SELECT c1 as want3results from t1 where c1 like 'l%'; +want3results +location +loberge +lotre +SELECT c1 as want3results from t1 where c1 like 'lo%'; +want3results +location +loberge +lotre +SELECT c1 as want1result from t1 where c1 like 'loc%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'loca%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'locat%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'locati%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'locatio%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'location%'; +want1result +location +DROP TABLE t1; +create table t1 (a set('a') not null); +insert into t1 values (),(); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +select cast(a as char(1)) from t1; +cast(a as char(1)) + + +select a sounds like a from t1; +a sounds like a +1 +1 +select 1 from t1 order by cast(a as char(1)); +1 +1 +1 +drop table t1; +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) COLLATE cp1250_czech_cs DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_czech_cs +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; +DROP DATABASE d1; +USE test; +SET character_set_server= @safe_character_set_server; +SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; CREATE TABLE t1 (a char(16)) character set cp1250 collate cp1250_czech_cs; INSERT INTO t1 VALUES (''); SELECT a, length(a), a='', a=' ', a=' ' FROM t1; diff --git a/mysql-test/r/ctype_cp932_binlog_row.result b/mysql-test/r/ctype_cp932_binlog_row.result index 39d7727b58a..0370b7a1cf6 100644 --- a/mysql-test/r/ctype_cp932_binlog_row.result +++ b/mysql-test/r/ctype_cp932_binlog_row.result @@ -9,8 +9,10 @@ EXECUTE stmt1 USING @var1; show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob) +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT SELECT HEX(f1) FROM t1; HEX(f1) 8300 diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result index cbdafc95b2a..946c06f1e07 100644 --- a/mysql-test/r/ctype_cp932_binlog_stm.result +++ b/mysql-test/r/ctype_cp932_binlog_stm.result @@ -40,9 +40,9 @@ IN ind DECIMAL(10,2)) BEGIN INSERT INTO t4 VALUES (ins1, ins2, ind); END -master-bin.000001 783 Query 1 999 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) -master-bin.000001 999 Query 1 1088 use `test`; DROP PROCEDURE bug18293 -master-bin.000001 1088 Query 1 1167 use `test`; DROP TABLE t4 +master-bin.000001 783 Query 1 991 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) +master-bin.000001 991 Query 1 1080 use `test`; DROP PROCEDURE bug18293 +master-bin.000001 1080 Query 1 1159 use `test`; DROP TABLE t4 End of 5.0 tests SHOW BINLOG EVENTS FROM 364; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result index ad9666d0c86..21aa38b7fe6 100755 --- a/mysql-test/r/ctype_eucjpms.result +++ b/mysql-test/r/ctype_eucjpms.result @@ -9809,6 +9809,23 @@ eucjpms_japanese_ci 6109 eucjpms_japanese_ci 61 eucjpms_japanese_ci 6120 drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET collation_connection='eucjpms_bin'; create table t1 select repeat('a',4000) a; delete from t1; @@ -9819,6 +9836,23 @@ eucjpms_bin 6109 eucjpms_bin 61 eucjpms_bin 6120 drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; select hex(convert(_eucjpms 0xA5FE41 using ucs2)); hex(convert(_eucjpms 0xA5FE41 using ucs2)) 003F0041 diff --git a/mysql-test/r/ctype_euckr.result b/mysql-test/r/ctype_euckr.result index bb1b3f5995b..6490044ea1a 100644 --- a/mysql-test/r/ctype_euckr.result +++ b/mysql-test/r/ctype_euckr.result @@ -3,6 +3,8 @@ SET @test_character_set= 'euckr'; SET @test_collation= 'euckr_korean_ci'; SET @safe_character_set_server= @@character_set_server; SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; SET character_set_server= @test_character_set; SET collation_server= @test_collation; CREATE DATABASE d1; @@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=euckr +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; DROP DATABASE d1; USE test; SET character_set_server= @safe_character_set_server; SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; SET NAMES euckr; SET collation_connection='euckr_korean_ci'; create table t1 select repeat('a',4000) a; @@ -124,6 +143,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET collation_connection='euckr_bin'; create table t1 select repeat('a',4000) a; delete from t1; @@ -174,6 +210,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET NAMES euckr; CREATE TABLE t1 (a text) character set euckr; INSERT INTO t1 VALUES (0xA2E6),(0xFEF7); diff --git a/mysql-test/r/ctype_gb2312.result b/mysql-test/r/ctype_gb2312.result index 95246525368..2f789ab5b13 100644 --- a/mysql-test/r/ctype_gb2312.result +++ b/mysql-test/r/ctype_gb2312.result @@ -3,6 +3,8 @@ SET @test_character_set= 'gb2312'; SET @test_collation= 'gb2312_chinese_ci'; SET @safe_character_set_server= @@character_set_server; SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; SET character_set_server= @test_character_set; SET collation_server= @test_collation; CREATE DATABASE d1; @@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=gb2312 +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; DROP DATABASE d1; USE test; SET character_set_server= @safe_character_set_server; SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; SET NAMES gb2312; SET collation_connection='gb2312_chinese_ci'; create table t1 select repeat('a',4000) a; @@ -124,6 +143,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET collation_connection='gb2312_bin'; create table t1 select repeat('a',4000) a; delete from t1; @@ -174,6 +210,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET NAMES gb2312; CREATE TABLE t1 (a text) character set gb2312; INSERT INTO t1 VALUES (0xA2A1),(0xD7FE); diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result index 8437e34be1e..98a6839be4c 100644 --- a/mysql-test/r/ctype_gbk.result +++ b/mysql-test/r/ctype_gbk.result @@ -3,6 +3,8 @@ SET @test_character_set= 'gbk'; SET @test_collation= 'gbk_chinese_ci'; SET @safe_character_set_server= @@character_set_server; SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; SET character_set_server= @test_character_set; SET collation_server= @test_collation; CREATE DATABASE d1; @@ -69,10 +71,27 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=gbk +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; DROP DATABASE d1; USE test; SET character_set_server= @safe_character_set_server; SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; SET NAMES gbk; SET collation_connection='gbk_chinese_ci'; create table t1 select repeat('a',4000) a; @@ -124,6 +143,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET collation_connection='gbk_bin'; create table t1 select repeat('a',4000) a; delete from t1; @@ -174,6 +210,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET NAMES gbk; CREATE TABLE t1 (a text) character set gbk; INSERT INTO t1 VALUES (0xA3A0),(0xA1A1); diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result index 5733877237d..f826199bb1f 100644 --- a/mysql-test/r/ctype_latin1_de.result +++ b/mysql-test/r/ctype_latin1_de.result @@ -326,6 +326,41 @@ latin1_german2_ci 6109 latin1_german2_ci 61 latin1_german2_ci 6120 drop table t1; +drop table if exists t1; +create table t1 as select repeat(' ', 64) as s1; +select collation(s1) from t1; +collation(s1) +latin1_german2_ci +delete from t1; +insert into t1 values ('a'),('ae'),(_latin1 0xE4); +insert into t1 values ('o'),('oe'),(_latin1 0xF6); +insert into t1 values ('s'),('ss'),(_latin1 0xDF); +insert into t1 values ('u'),('ue'),(_latin1 0xFC); +select s1, hex(s1) from t1 order by s1, binary s1; +s1 hex(s1) +a 61 +ae 6165 +ä E4 +o 6F +oe 6F65 +ö F6 +s 73 +ss 7373 +ß DF +u 75 +ue 7565 +ü FC +select group_concat(s1 order by binary s1) from t1 group by s1; +group_concat(s1 order by binary s1) +a +ae,ä +o +oe,ö +s +ss,ß +u +ue,ü +drop table t1; SET NAMES latin1; CREATE TABLE t1 ( col1 varchar(255) NOT NULL default '' diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result index 1c9d540d574..91d6ebd9795 100644 --- a/mysql-test/r/ctype_sjis.result +++ b/mysql-test/r/ctype_sjis.result @@ -121,6 +121,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET collation_connection='sjis_bin'; create table t1 select repeat('a',4000) a; delete from t1; @@ -171,6 +188,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET NAMES sjis; SELECT HEX('²“‘@Œ\') FROM DUAL; HEX('²“‘@Œ\') diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result index 92b76802d0b..04727f84ff2 100644 --- a/mysql-test/r/ctype_uca.result +++ b/mysql-test/r/ctype_uca.result @@ -2538,6 +2538,8 @@ SET @test_character_set= 'utf8'; SET @test_collation= 'utf8_swedish_ci'; SET @safe_character_set_server= @@character_set_server; SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; SET character_set_server= @test_character_set; SET collation_server= @test_collation; CREATE DATABASE d1; @@ -2604,10 +2606,27 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) COLLATE utf8_swedish_ci DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; DROP DATABASE d1; USE test; SET character_set_server= @safe_character_set_server; SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci; insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c'); select a, a regexp '[a]' from t1 order by binary a; @@ -2647,6 +2666,41 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +drop table if exists t1; +create table t1 as select repeat(' ', 64) as s1; +select collation(s1) from t1; +collation(s1) +utf8_unicode_ci +delete from t1; +insert into t1 values ('a'),('ae'),(_latin1 0xE4); +insert into t1 values ('o'),('oe'),(_latin1 0xF6); +insert into t1 values ('s'),('ss'),(_latin1 0xDF); +insert into t1 values ('u'),('ue'),(_latin1 0xFC); +select s1, hex(s1) from t1 order by s1, binary s1; +s1 hex(s1) +a 61 +ä C3A4 +ae 6165 +o 6F +ö C3B6 +oe 6F65 +s 73 +ss 7373 +ß C39F +u 75 +ü C3BC +ue 7565 +select group_concat(s1 order by binary s1) from t1 group by s1; +group_concat(s1 order by binary s1) +a,ä +ae +o,ö +oe +s +ss,ß +u,ü +ue +drop table t1; CREATE TABLE t1 (id int, a varchar(30) character set utf8); INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131); INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049); @@ -2815,5 +2869,22 @@ NULL NULL NULL drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; set names utf8; End for 5.0 tests diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index bd76f2a859f..20dd85834dd 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -1,4 +1,97 @@ DROP TABLE IF EXISTS t1; +SET @test_character_set= 'ucs2'; +SET @test_collation= 'ucs2_general_ci'; +SET @safe_character_set_server= @@character_set_server; +SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; +SET character_set_server= @test_character_set; +SET collation_server= @test_collation; +CREATE DATABASE d1; +USE d1; +CREATE TABLE t1 (c CHAR(10), KEY(c)); +SHOW FULL COLUMNS FROM t1; +Field Type Collation Null Key Default Extra Privileges Comment +c char(10) ucs2_general_ci YES MUL NULL +INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa'); +SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%'; +want3results +aaa +aaaa +aaaaa +DROP TABLE t1; +CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2))); +SHOW FULL COLUMNS FROM t1; +Field Type Collation Null Key Default Extra Privileges Comment +c1 varchar(15) ucs2_general_ci YES MUL NULL +INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab'); +SELECT c1 as want3results from t1 where c1 like 'l%'; +want3results +location +loberge +lotre +SELECT c1 as want3results from t1 where c1 like 'lo%'; +want3results +location +loberge +lotre +SELECT c1 as want1result from t1 where c1 like 'loc%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'loca%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'locat%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'locati%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'locatio%'; +want1result +location +SELECT c1 as want1result from t1 where c1 like 'location%'; +want1result +location +DROP TABLE t1; +create table t1 (a set('a') not null); +insert into t1 values (),(); +Warnings: +Warning 1364 Field 'a' doesn't have a default value +select cast(a as char(1)) from t1; +cast(a as char(1)) + + +select a sounds like a from t1; +a sounds like a +1 +1 +select 1 from t1 order by cast(a as char(1)); +1 +1 +1 +drop table t1; +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=ucs2 +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; +DROP DATABASE d1; +USE test; +SET character_set_server= @safe_character_set_server; +SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; SET NAMES latin1; SET character_set_connection=ucs2; select 'a' = 'a', 'a' = 'a ', 'a ' = 'a'; @@ -613,6 +706,58 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +drop table if exists t1; +create table t1 as select repeat(' ', 64) as s1; +select collation(s1) from t1; +collation(s1) +ucs2_general_ci +delete from t1; +insert into t1 values ('a'),('ae'),(_latin1 0xE4); +insert into t1 values ('o'),('oe'),(_latin1 0xF6); +insert into t1 values ('s'),('ss'),(_latin1 0xDF); +insert into t1 values ('u'),('ue'),(_latin1 0xFC); +select s1, hex(s1) from t1 order by s1, binary s1; +s1 hex(s1) +a 0061 +ä 00E4 +ae 00610065 +o 006F +ö 00F6 +oe 006F0065 +s 0073 +ß 00DF +ss 00730073 +u 0075 +ü 00FC +ue 00750065 +select group_concat(s1 order by binary s1) from t1 group by s1; +group_concat(s1 order by binary s1) +a,ä +ae +o,ö +oe +s,ß +ss +u,ü +ue +drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET NAMES latin1; SET collation_connection='ucs2_bin'; create table t1 select repeat('a',4000) a; @@ -642,6 +787,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F20025 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; select hex(substr(_ucs2 0x00e400e50068,1)); hex(substr(_ucs2 0x00e400e50068,1)) 00E400E50068 diff --git a/mysql-test/r/ctype_ucs2_def.result b/mysql-test/r/ctype_ucs2_def.result index 6fd45428368..005d46062fb 100644 --- a/mysql-test/r/ctype_ucs2_def.result +++ b/mysql-test/r/ctype_ucs2_def.result @@ -21,4 +21,14 @@ INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C'); INSERT INTO t1 VALUES('A ', 'A '); ERROR 23000: Duplicate entry '' for key 'key1' DROP TABLE t1; +CREATE TABLE t1 ( +c1 CHAR(255) CHARACTER SET UCS2 COLLATE UCS2_BIN NOT NULL, +KEY(c1) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('marshall\'s'); +INSERT INTO t1 VALUES ('marsh'); +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result index d95b8cf9efb..540ba178756 100644 --- a/mysql-test/r/ctype_ujis.result +++ b/mysql-test/r/ctype_ujis.result @@ -2257,6 +2257,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET collation_connection='ujis_bin'; create table t1 select repeat('a',4000) a; delete from t1; @@ -2307,6 +2324,23 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; select hex(convert(_ujis 0xA5FE41 using ucs2)); hex(convert(_ujis 0xA5FE41 using ucs2)) 003F0041 diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 5c90c3b5e0b..12e6c9bb492 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -939,6 +939,41 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +drop table if exists t1; +create table t1 as select repeat(' ', 64) as s1; +select collation(s1) from t1; +collation(s1) +utf8_general_ci +delete from t1; +insert into t1 values ('a'),('ae'),(_latin1 0xE4); +insert into t1 values ('o'),('oe'),(_latin1 0xF6); +insert into t1 values ('s'),('ss'),(_latin1 0xDF); +insert into t1 values ('u'),('ue'),(_latin1 0xFC); +select s1, hex(s1) from t1 order by s1, binary s1; +s1 hex(s1) +a 61 +ä C3A4 +ae 6165 +o 6F +ö C3B6 +oe 6F65 +s 73 +ß C39F +ss 7373 +u 75 +ü C3BC +ue 7565 +select group_concat(s1 order by binary s1) from t1 group by s1; +group_concat(s1 order by binary s1) +a,ä +ae +o,ö +oe +s,ß +ss +u,ü +ue +drop table t1; SET collation_connection='utf8_bin'; create table t1 select repeat('a',4000) a; delete from t1; diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result index fbe46e9fa21..dfd8244ef77 100644 --- a/mysql-test/r/date_formats.result +++ b/mysql-test/r/date_formats.result @@ -445,7 +445,7 @@ explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", 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 makedate(1997,1) AS `makedate(1997,1)`,addtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'1 1.1.1.000002') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime(_latin1'31.12.97 11.59.59.999999 PM',_latin1'1 1.1.1.000002') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff(_latin1'01.01.97 11:59:59.000001 PM',_latin1'31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date(_latin1'15-01-2001 12:59:59',_latin1'%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond(_latin1'1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")` +Note 1003 select makedate(1997,1) AS `makedate(1997,1)`,addtime('31.12.97 11.59.59.999999 PM','1 1.1.1.000002') AS `addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,subtime('31.12.97 11.59.59.999999 PM','1 1.1.1.000002') AS `subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002")`,timediff('01.01.97 11:59:59.000001 PM','31.12.95 11:59:59.000002 PM') AS `timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM")`,cast(str_to_date('15-01-2001 12:59:59','%d-%m-%Y %H:%i:%S') as time) AS `cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME)`,maketime(23,11,12) AS `maketime(23,11,12)`,microsecond('1997-12-31 23:59:59.000001') AS `microsecond("1997-12-31 23:59:59.000001")` create table t1 (d date); insert into t1 values ('2004-07-14'),('2005-07-14'); select date_format(d,"%d") from t1 order by 1; diff --git a/mysql-test/r/ddl_i18n_koi8r.result b/mysql-test/r/ddl_i18n_koi8r.result index fbaf2f2fd4a..34cea2a5a7d 100644 --- a/mysql-test/r/ddl_i18n_koi8r.result +++ b/mysql-test/r/ddl_i18n_koi8r.result @@ -16,25 +16,34 @@ FROM t1| CREATE VIEW v2 AS SELECT _utf8'теÑÑ‚' as c1| +CREATE VIEW v3 AS SELECT _utf8'теÑÑ‚'| + SHOW CREATE VIEW v1| View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _koi8r'ÔÅÓÔ' AS `c1`,`t1`.`ËÏÌ` AS `c2` from `t1` koi8r koi8r_general_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'ÔÅÓÔ' AS `c1`,`t1`.`ËÏÌ` AS `c2` from `t1` koi8r koi8r_general_ci SHOW CREATE VIEW v2| View Create View character_set_client collation_connection v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _utf8'теÑÑ‚' AS `c1` koi8r koi8r_general_ci +SHOW CREATE VIEW v3| +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _utf8'теÑÑ‚' AS `ÔÅÓÔ` koi8r koi8r_general_ci + SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL mysqltest1 v1 SELECT 'ÔÅÓÔ' AS c1, ËÏÌ AS c2 -FROM t1 NONE YES root@localhost DEFINER koi8r koi8r_general_ci +NULL mysqltest1 v1 select 'ÔÅÓÔ' AS `c1`,`mysqltest1`.`t1`.`ËÏÌ` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL mysqltest1 v2 SELECT 'ÔÅÓÔ' as c1 NONE NO root@localhost DEFINER koi8r koi8r_general_ci +NULL mysqltest1 v2 select 'ÔÅÓÔ' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v3 select 'ÔÅÓÔ' AS `ÔÅÓÔ` NONE NO root@localhost DEFINER koi8r koi8r_general_ci SELECT COLLATION(c1), COLLATION(c2) FROM v1| @@ -45,6 +54,10 @@ SELECT COLLATION(c1) FROM v2| COLLATION(c1) utf8_general_ci +SELECT * FROM v3| +ÔÅÓÔ +ÔÅÓÔ + ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| @@ -54,27 +67,35 @@ SET @@character_set_results= cp1251| SET @@collation_connection= cp1251_general_ci| SELECT * FROM mysqltest1.v1| SELECT * FROM mysqltest1.v2| +SELECT * FROM mysqltest1.v3| use mysqltest1| set names koi8r| SHOW CREATE VIEW v1| View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _koi8r'ÔÅÓÔ' AS `c1`,`t1`.`ËÏÌ` AS `c2` from `t1` koi8r koi8r_general_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'ÔÅÓÔ' AS `c1`,`t1`.`ËÏÌ` AS `c2` from `t1` koi8r koi8r_general_ci SHOW CREATE VIEW v2| View Create View character_set_client collation_connection v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _utf8'теÑÑ‚' AS `c1` koi8r koi8r_general_ci +SHOW CREATE VIEW v3| +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _utf8'теÑÑ‚' AS `ÔÅÓÔ` koi8r koi8r_general_ci + SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL mysqltest1 v1 SELECT 'ÔÅÓÔ' AS c1, ËÏÌ AS c2 -FROM t1 NONE YES root@localhost DEFINER koi8r koi8r_general_ci +NULL mysqltest1 v1 select 'ÔÅÓÔ' AS `c1`,`mysqltest1`.`t1`.`ËÏÌ` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL mysqltest1 v2 SELECT 'ÔÅÓÔ' as c1 NONE NO root@localhost DEFINER koi8r koi8r_general_ci +NULL mysqltest1 v2 select 'ÔÅÓÔ' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v3 select 'ÔÅÓÔ' AS `ÔÅÓÔ` NONE NO root@localhost DEFINER koi8r koi8r_general_ci SELECT COLLATION(c1), COLLATION(c2) FROM v1| @@ -85,6 +106,10 @@ SELECT COLLATION(c1) FROM v2| COLLATION(c1) utf8_general_ci +SELECT * FROM v3| +ÔÅÓÔ +ÔÅÓÔ + ---> Dumping mysqltest1 to ddl_i18n_koi8r.views.mysqltest1.sql @@ -99,27 +124,36 @@ SET @@character_set_results= cp1251| SET @@collation_connection= cp1251_general_ci| SELECT * FROM mysqltest1.v1| SELECT * FROM mysqltest1.v2| +SELECT * FROM mysqltest1.v3| use mysqltest1| set names koi8r| SHOW CREATE VIEW v1| View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _koi8r'ÔÅÓÔ' AS `c1`,`t1`.`ËÏÌ` AS `c2` from `t1` koi8r koi8r_general_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'ÔÅÓÔ' AS `c1`,`t1`.`ËÏÌ` AS `c2` from `t1` koi8r koi8r_general_ci SHOW CREATE VIEW v2| View Create View character_set_client collation_connection v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _utf8'теÑÑ‚' AS `c1` koi8r koi8r_general_ci +SHOW CREATE VIEW v3| +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _utf8'теÑÑ‚' AS `ÔÅÓÔ` koi8r koi8r_general_ci + SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL mysqltest1 v1 select 'ÔÅÓÔ' AS `c1`,`t1`.`ËÏÌ` AS `c2` from `t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci +NULL mysqltest1 v1 select 'ÔÅÓÔ' AS `c1`,`mysqltest1`.`t1`.`ËÏÌ` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION NULL mysqltest1 v2 select 'ÔÅÓÔ' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v3 select 'ÔÅÓÔ' AS `ÔÅÓÔ` NONE NO root@localhost DEFINER koi8r koi8r_general_ci + SELECT COLLATION(c1), COLLATION(c2) FROM v1| COLLATION(c1) COLLATION(c2) @@ -129,6 +163,10 @@ SELECT COLLATION(c1) FROM v2| COLLATION(c1) utf8_general_ci +SELECT * FROM v3| +ÔÅÓÔ +ÔÅÓÔ + ---> connection: default use test| DROP DATABASE mysqltest1| diff --git a/mysql-test/r/ddl_i18n_utf8.result b/mysql-test/r/ddl_i18n_utf8.result index d0f176c1985..cf5dac3dc7c 100644 --- a/mysql-test/r/ddl_i18n_utf8.result +++ b/mysql-test/r/ddl_i18n_utf8.result @@ -16,25 +16,34 @@ FROM t1| CREATE VIEW v2 AS SELECT _koi8r'ÔÅÓÔ' as c1| +CREATE VIEW v3 AS SELECT _koi8r'ÔÅÓÔ'| + SHOW CREATE VIEW v1| View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _utf8'теÑÑ‚' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'теÑÑ‚' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci SHOW CREATE VIEW v2| View Create View character_set_client collation_connection v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _koi8r'ÔÅÓÔ' AS `c1` utf8 utf8_general_ci +SHOW CREATE VIEW v3| +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _koi8r'ÔÅÓÔ' AS `теÑÑ‚` utf8 utf8_general_ci + SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL mysqltest1 v1 SELECT 'теÑÑ‚' AS c1, кол AS c2 -FROM t1 NONE YES root@localhost DEFINER utf8 utf8_general_ci +NULL mysqltest1 v1 select 'теÑÑ‚' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL mysqltest1 v2 SELECT 'теÑÑ‚' as c1 NONE NO root@localhost DEFINER utf8 utf8_general_ci +NULL mysqltest1 v2 select 'теÑÑ‚' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v3 select 'теÑÑ‚' AS `теÑÑ‚` NONE NO root@localhost DEFINER utf8 utf8_general_ci SELECT COLLATION(c1), COLLATION(c2) FROM v1| @@ -45,6 +54,10 @@ SELECT COLLATION(c1) FROM v2| COLLATION(c1) koi8r_general_ci +SELECT * FROM v3| +теÑÑ‚ +теÑÑ‚ + ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| @@ -54,27 +67,35 @@ SET @@character_set_results= cp1251| SET @@collation_connection= cp1251_general_ci| SELECT * FROM mysqltest1.v1| SELECT * FROM mysqltest1.v2| +SELECT * FROM mysqltest1.v3| use mysqltest1| set names utf8| SHOW CREATE VIEW v1| View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _utf8'теÑÑ‚' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'теÑÑ‚' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci SHOW CREATE VIEW v2| View Create View character_set_client collation_connection v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _koi8r'ÔÅÓÔ' AS `c1` utf8 utf8_general_ci +SHOW CREATE VIEW v3| +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _koi8r'ÔÅÓÔ' AS `теÑÑ‚` utf8 utf8_general_ci + SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL mysqltest1 v1 SELECT 'теÑÑ‚' AS c1, кол AS c2 -FROM t1 NONE YES root@localhost DEFINER utf8 utf8_general_ci +NULL mysqltest1 v1 select 'теÑÑ‚' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL mysqltest1 v2 SELECT 'теÑÑ‚' as c1 NONE NO root@localhost DEFINER utf8 utf8_general_ci +NULL mysqltest1 v2 select 'теÑÑ‚' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v3 select 'теÑÑ‚' AS `теÑÑ‚` NONE NO root@localhost DEFINER utf8 utf8_general_ci SELECT COLLATION(c1), COLLATION(c2) FROM v1| @@ -85,6 +106,10 @@ SELECT COLLATION(c1) FROM v2| COLLATION(c1) koi8r_general_ci +SELECT * FROM v3| +теÑÑ‚ +теÑÑ‚ + ---> Dumping mysqltest1 to ddl_i18n_utf8views.mysqltest1.sql @@ -99,27 +124,36 @@ SET @@character_set_results= cp1251| SET @@collation_connection= cp1251_general_ci| SELECT * FROM mysqltest1.v1| SELECT * FROM mysqltest1.v2| +SELECT * FROM mysqltest1.v3| use mysqltest1| set names utf8| SHOW CREATE VIEW v1| View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _utf8'теÑÑ‚' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'теÑÑ‚' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci SHOW CREATE VIEW v2| View Create View character_set_client collation_connection v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _koi8r'ÔÅÓÔ' AS `c1` utf8 utf8_general_ci +SHOW CREATE VIEW v3| +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select _koi8r'ÔÅÓÔ' AS `теÑÑ‚` utf8 utf8_general_ci + SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL mysqltest1 v1 select 'теÑÑ‚' AS `c1`,`t1`.`кол` AS `c2` from `t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci +NULL mysqltest1 v1 select 'теÑÑ‚' AS `c1`,`mysqltest1`.`t1`.`кол` AS `c2` from `mysqltest1`.`t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION NULL mysqltest1 v2 select 'теÑÑ‚' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v3'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v3 select 'теÑÑ‚' AS `теÑÑ‚` NONE NO root@localhost DEFINER utf8 utf8_general_ci + SELECT COLLATION(c1), COLLATION(c2) FROM v1| COLLATION(c1) COLLATION(c2) @@ -129,6 +163,10 @@ SELECT COLLATION(c1) FROM v2| COLLATION(c1) koi8r_general_ci +SELECT * FROM v3| +теÑÑ‚ +теÑÑ‚ + ---> connection: default use test| DROP DATABASE mysqltest1| diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index b2a9eb04c04..15e4c3f15b3 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -682,3 +682,26 @@ a a b 1 1 3 DROP TABLE t1; End of 5.0 tests +CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT, +PRIMARY KEY(a,b,c,d,e), +KEY(a,b,d,c) +); +INSERT INTO t1(a, b, c) VALUES (1, 1, 1), +(1, 1, 2), +(1, 1, 3), +(1, 2, 1), +(1, 2, 2), +(1, 2, 3); +EXPLAIN SELECT DISTINCT a, b, d, c FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL a 16 NULL 6 Using index +SELECT DISTINCT a, b, d, c FROM t1; +a b d c +1 1 0 1 +1 1 0 2 +1 1 0 3 +1 2 0 1 +1 2 0 2 +1 2 0 3 +DROP TABLE t1; +End of 5.1 tests diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result index 71d6fcc7cd0..cd6877b2967 100644 --- a/mysql-test/r/drop.result +++ b/mysql-test/r/drop.result @@ -91,4 +91,31 @@ create table mysql_test.`#sql-347f_7` (f1 int); create table mysql_test.`#sql-347f_8` (f1 int); drop table mysql_test.`#sql-347f_8`; drop database mysql_test; + +# -- +# -- Bug#29958: Weird message on DROP DATABASE if mysql.proc does not +# -- exist. +# -- +DROP DATABASE IF EXISTS mysql_test; +CREATE DATABASE mysql_test; +DROP TABLE mysql.proc; +DROP DATABASE mysql_test; +Warnings: +Error 1146 Table 'mysql.proc' doesn't exist + +# -- +# -- End of Bug#29958. +# -- + +create database mysqltestbug26703; +use mysqltestbug26703; +create table `#mysql50#abc``def` ( id int ); +create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int); +ERROR 42000: Incorrect table name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int); +create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int); +create table `#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (a int); +ERROR 42000: Incorrect table name '#mysql50#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +use test; +drop database mysqltestbug26703; End of 5.1 tests diff --git a/mysql-test/r/events.result b/mysql-test/r/events_1.result similarity index 62% rename from mysql-test/r/events.result rename to mysql-test/r/events_1.result index 7b68914e219..e7b645f5556 100644 --- a/mysql-test/r/events.result +++ b/mysql-test/r/events_1.result @@ -309,7 +309,7 @@ ERROR HY000: Unknown event 'intact_check' DROP EVENT no_such_event; ERROR HY000: Unknown event 'no_such_event' CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5; -ERROR HY000: Cannot load from mysql.event. The table is probably corrupted +ERROR HY000: Failed to store event name. Error code 2 from storage engine. ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8; ERROR HY000: Unknown event 'intact_check_1' ALTER EVENT intact_check_1 RENAME TO intact_check_2; @@ -425,321 +425,4 @@ CREATE TABLE mysql.event like event_like; DROP TABLE event_like; 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 -create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5; -select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; -db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion -events_test e_26 set @a = 5 root@localhost 2017-01-01 00:00:00 DROP -drop event e_26; -create event e_26 on schedule at NULL disable do set @a = 5; -ERROR HY000: Incorrect AT value: 'NULL' -create event e_26 on schedule at 'definitely not a datetime' disable do set @a = 5; -ERROR HY000: Incorrect AT value: 'definitely not a datetime' -set names utf8; -create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1; -drop event задачка; -set event_scheduler=off; -ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL -set global event_scheduler=3; -ERROR 42000: Variable 'event_scheduler' can't be set to the value of '3' -set global event_scheduler=disabled; -ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled' -"DISABLE the scheduler. Testing that it does not work when the variable is 0" -set global event_scheduler=off; -select definer, name, db from mysql.event; -definer name db -select get_lock("test_lock1", 20); -get_lock("test_lock1", 20) -1 -create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20); -"Should return 1 row" -select definer, name, db from mysql.event; -definer name db -root@localhost закачка events_test -"Should be only 0 process" -select /*1*/ user, host, db, command, state, info -from information_schema.processlist -where (user='event_scheduler') -order by info; -user host db command state info -select release_lock("test_lock1"); -release_lock("test_lock1") -1 -drop event закачка; -"Should have 0 events" -select count(*) from mysql.event; -count(*) -0 -"ENABLE the scheduler and get a lock" -set global event_scheduler=on; -select get_lock("test_lock2", 20); -get_lock("test_lock2", 20) -1 -"Create an event which tries to acquire a mutex. The event locks on the mutex" -create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20); -"Should have only 2 processes: the scheduler and the locked event" -select /*2*/ user, host, db, command, state, info -from information_schema.processlist -where (info like "select get_lock%" OR user='event_scheduler') -order by info; -user host db command state info -event_scheduler localhost NULL Daemon Waiting for next activation NULL -root localhost events_test Connect User lock select get_lock("test_lock2", 20) -"Release the mutex, the event worker should finish." -select release_lock("test_lock2"); -release_lock("test_lock2") -1 -drop event закачка; -set global event_scheduler=1; -select get_lock("test_lock2_1", 20); -get_lock("test_lock2_1", 20) -1 -create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20); -"Should have only 2 processes: the scheduler and the locked event" -select /*3*/ user, host, db, command, state, info -from information_schema.processlist -where (info like "select get_lock%" OR user='event_scheduler') -order by info; -user host db command state info -event_scheduler localhost NULL Daemon Waiting for next activation NULL -root localhost events_test Connect User lock select get_lock("test_lock2_1", 20) -set global event_scheduler=off; -"Should have only our process now:" -select /*4*/ user, host, db, command, state, info -from information_schema.processlist -where (info like "select get_lock%" OR user='event_scheduler') -order by info; -user host db command state info -root localhost events_test Connect User lock select get_lock("test_lock2_1", 20) -select release_lock("test_lock2_1"); -release_lock("test_lock2_1") -1 -drop event закачка21; -create table t_16 (s1 int); -create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5; -ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present -drop table t_16; -create event white_space -on schedule every 10 hour -disable -do -select 1; -select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space'; -event_schema event_name definer event_definition -events_test white_space root@localhost select 1 -drop event white_space; -create event white_space on schedule every 10 hour disable do -select 2; -select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space'; -event_schema event_name definer event_definition -events_test white_space root@localhost select 2 -drop event white_space; -create event white_space on schedule every 10 hour disable do select 3; -select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space'; -event_schema event_name definer event_definition -events_test white_space root@localhost select 3 -drop event white_space; -create event e1 on schedule every 1 year do set @a = 5; -create table t1 (s1 int); -create trigger t1_ai after insert on t1 for each row show create event e1; -ERROR 0A000: Not allowed to return a result set from a trigger -drop table t1; -drop event e1; -SHOW EVENTS FROM aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; -ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' -SHOW EVENTS FROM ``; -ERROR 42000: Incorrect database name '' -SHOW EVENTS FROM `events\\test`; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation - -LOCK TABLES mode. - -create table t1 (a int); -create event e1 on schedule every 10 hour do select 1; -lock table t1 read; -show create event e1; -Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci -select event_name from information_schema.events; -event_name -e1 -create event e2 on schedule every 10 hour do select 1; -ERROR HY000: Table 'event' was not locked with LOCK TABLES -alter event e2 disable; -ERROR HY000: Table 'event' was not locked with LOCK TABLES -alter event e2 rename to e3; -ERROR HY000: Table 'event' was not locked with LOCK TABLES -drop event e2; -ERROR HY000: Table 'event' was not locked with LOCK TABLES -drop event e1; -ERROR HY000: Table 'event' was not locked with LOCK TABLES -unlock tables; -lock table t1 write; -show create event e1; -Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci -select event_name from information_schema.events; -event_name -e1 -create event e2 on schedule every 10 hour do select 1; -ERROR HY000: Table 'event' was not locked with LOCK TABLES -alter event e2 disable; -ERROR HY000: Table 'event' was not locked with LOCK TABLES -alter event e2 rename to e3; -ERROR HY000: Table 'event' was not locked with LOCK TABLES -drop event e2; -ERROR HY000: Table 'event' was not locked with LOCK TABLES -drop event e1; -ERROR HY000: Table 'event' was not locked with LOCK TABLES -unlock tables; -lock table t1 read, mysql.event read; -show create event e1; -Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci -select event_name from information_schema.events; -event_name -e1 -create event e2 on schedule every 10 hour do select 1; -ERROR HY000: Table 'event' was locked with a READ lock and can't be updated -alter event e2 disable; -ERROR HY000: Table 'event' was locked with a READ lock and can't be updated -alter event e2 rename to e3; -ERROR HY000: Table 'event' was locked with a READ lock and can't be updated -drop event e2; -ERROR HY000: Table 'event' was locked with a READ lock and can't be updated -drop event e1; -ERROR HY000: Table 'event' was locked with a READ lock and can't be updated -unlock tables; -lock table t1 write, mysql.event read; -show create event e1; -Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci -select event_name from information_schema.events; -event_name -e1 -create event e2 on schedule every 10 hour do select 1; -ERROR HY000: Table 'event' was locked with a READ lock and can't be updated -alter event e2 disable; -ERROR HY000: Table 'event' was locked with a READ lock and can't be updated -alter event e2 rename to e3; -ERROR HY000: Table 'event' was locked with a READ lock and can't be updated -drop event e2; -ERROR HY000: Table 'event' was locked with a READ lock and can't be updated -drop event e1; -ERROR HY000: Table 'event' was locked with a READ lock and can't be updated -unlock tables; -lock table t1 read, mysql.event write; -ERROR HY000: You can't combine write-locking of system tables with other tables or lock types -lock table t1 write, mysql.event write; -ERROR HY000: You can't combine write-locking of system tables with other tables or lock types -lock table mysql.event write; -show create event e1; -Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci -select event_name from information_schema.events; -event_name -e1 -create event e2 on schedule every 10 hour do select 1; -alter event e2 disable; -alter event e2 rename to e3; -drop event e3; -drop event e1; -unlock tables; -Make sure we have left no events -select event_name from information_schema.events; -event_name - -Events in sub-statements, events and prelocking - - -create event e1 on schedule every 10 hour do select 1; -create function f1() returns int -begin -show create event e1; -return 1; -end| -ERROR 0A000: Not allowed to return a result set from a function -create trigger trg before insert on t1 for each row -begin -show create event e1; -end| -ERROR 0A000: Not allowed to return a result set from a trigger -create function f1() returns int -begin -select event_name from information_schema.events; -return 1; -end| -ERROR 0A000: Not allowed to return a result set from a function -create trigger trg before insert on t1 for each row -begin -select event_name from information_schema.events; -end| -ERROR 0A000: Not allowed to return a result set from a trigger -create function f1() returns int -begin -create event e2 on schedule every 10 hour do select 1; -return 1; -end| -ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present -create function f1() returns int -begin -alter event e1 rename to e2; -return 1; -end| -ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. -create function f1() returns int -begin -drop event e2; -return 1; -end| -ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. ----------------------------------------------------------------------- -create trigger trg before insert on t1 for each row -begin -set new.a= f1(); -end| -create function f1() returns int -begin -call p1(); -return 0; -end| -create procedure p1() -begin -select event_name from information_schema.events; -end| -insert into t1 (a) values (1)| -ERROR 0A000: Not allowed to return a result set from a trigger -drop procedure p1| -create procedure p1() -begin -show create event e1; -end| -insert into t1 (a) values (1)| -ERROR 0A000: Not allowed to return a result set from a trigger -drop procedure p1| -create procedure p1() -begin -create temporary table tmp select event_name from information_schema.events; -end| -expected to work, since we redirect the output into a tmp table -insert into t1 (a) values (1)| -select * from tmp| -event_name -e1 -drop temporary table tmp| -drop procedure p1| -create procedure p1() -begin -alter event e1 rename to e2; -end| -insert into t1 (a) values (1)| -ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. -drop procedure p1| -create procedure p1() -begin -drop event e1; -end| -insert into t1 (a) values (1)| -ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. -drop table t1| -drop event e1| drop database events_test; diff --git a/mysql-test/r/events_2.result b/mysql-test/r/events_2.result new file mode 100644 index 00000000000..9da8c37edae --- /dev/null +++ b/mysql-test/r/events_2.result @@ -0,0 +1,321 @@ +drop database if exists events_test; +create database events_test; +use events_test; +create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5; +select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; +db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion +events_test e_26 set @a = 5 root@localhost 2017-01-01 00:00:00 DROP +drop event e_26; +create event e_26 on schedule at NULL disable do set @a = 5; +ERROR HY000: Incorrect AT value: 'NULL' +create event e_26 on schedule at 'definitely not a datetime' disable do set @a = 5; +ERROR HY000: Incorrect AT value: 'definitely not a datetime' +set names utf8; +create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1; +drop event задачка; +set event_scheduler=off; +ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL +set global event_scheduler=3; +ERROR 42000: Variable 'event_scheduler' can't be set to the value of '3' +set global event_scheduler=disabled; +ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled' +"DISABLE the scheduler. Testing that it does not work when the variable is 0" +set global event_scheduler=off; +select definer, name, db from mysql.event; +definer name db +select get_lock("test_lock1", 20); +get_lock("test_lock1", 20) +1 +create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20); +"Should return 1 row" +select definer, name, db from mysql.event; +definer name db +root@localhost закачка events_test +"Should be only 0 process" +select /*1*/ user, host, db, command, state, info +from information_schema.processlist +where (user='event_scheduler') +order by info; +user host db command state info +select release_lock("test_lock1"); +release_lock("test_lock1") +1 +drop event закачка; +"Should have 0 events" +select count(*) from mysql.event; +count(*) +0 +"ENABLE the scheduler and get a lock" +set global event_scheduler=on; +select get_lock("test_lock2", 20); +get_lock("test_lock2", 20) +1 +"Create an event which tries to acquire a mutex. The event locks on the mutex" +create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20); +"Should have only 2 processes: the scheduler and the locked event" +select /*2*/ user, host, db, command, state, info +from information_schema.processlist +where (info like "select get_lock%" OR user='event_scheduler') +order by info; +user host db command state info +event_scheduler localhost NULL Daemon Waiting for next activation NULL +root localhost events_test Connect User lock select get_lock("test_lock2", 20) +"Release the mutex, the event worker should finish." +select release_lock("test_lock2"); +release_lock("test_lock2") +1 +drop event закачка; +set global event_scheduler=1; +select get_lock("test_lock2_1", 20); +get_lock("test_lock2_1", 20) +1 +create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20); +"Should have only 2 processes: the scheduler and the locked event" +select /*3*/ user, host, db, command, state, info +from information_schema.processlist +where (info like "select get_lock%" OR user='event_scheduler') +order by info; +user host db command state info +event_scheduler localhost NULL Daemon Waiting for next activation NULL +root localhost events_test Connect User lock select get_lock("test_lock2_1", 20) +set global event_scheduler=off; +"Should have only our process now:" +select /*4*/ user, host, db, command, state, info +from information_schema.processlist +where (info like "select get_lock%" OR user='event_scheduler') +order by info; +user host db command state info +root localhost events_test Connect User lock select get_lock("test_lock2_1", 20) +select release_lock("test_lock2_1"); +release_lock("test_lock2_1") +1 +drop event закачка21; +create table t_16 (s1 int); +create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5; +ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present +drop table t_16; +create event white_space +on schedule every 10 hour +disable +do +select 1; +select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space'; +event_schema event_name definer event_definition +events_test white_space root@localhost select 1 +drop event white_space; +create event white_space on schedule every 10 hour disable do +select 2; +select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space'; +event_schema event_name definer event_definition +events_test white_space root@localhost select 2 +drop event white_space; +create event white_space on schedule every 10 hour disable do select 3; +select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space'; +event_schema event_name definer event_definition +events_test white_space root@localhost select 3 +drop event white_space; +create event e1 on schedule every 1 year do set @a = 5; +create table t1 (s1 int); +create trigger t1_ai after insert on t1 for each row show create event e1; +ERROR 0A000: Not allowed to return a result set from a trigger +drop table t1; +drop event e1; +SHOW EVENTS FROM aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; +ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' +SHOW EVENTS FROM ``; +ERROR 42000: Incorrect database name '' +SHOW EVENTS FROM `events\\test`; +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + +LOCK TABLES mode. + +create table t1 (a int); +create event e1 on schedule every 10 hour do select 1; +lock table t1 read; +show create event e1; +Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation +e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +select event_name from information_schema.events; +event_name +e1 +create event e2 on schedule every 10 hour do select 1; +ERROR HY000: Table 'event' was not locked with LOCK TABLES +alter event e2 disable; +ERROR HY000: Table 'event' was not locked with LOCK TABLES +alter event e2 rename to e3; +ERROR HY000: Table 'event' was not locked with LOCK TABLES +drop event e2; +ERROR HY000: Table 'event' was not locked with LOCK TABLES +drop event e1; +ERROR HY000: Table 'event' was not locked with LOCK TABLES +unlock tables; +lock table t1 write; +show create event e1; +Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation +e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +select event_name from information_schema.events; +event_name +e1 +create event e2 on schedule every 10 hour do select 1; +ERROR HY000: Table 'event' was not locked with LOCK TABLES +alter event e2 disable; +ERROR HY000: Table 'event' was not locked with LOCK TABLES +alter event e2 rename to e3; +ERROR HY000: Table 'event' was not locked with LOCK TABLES +drop event e2; +ERROR HY000: Table 'event' was not locked with LOCK TABLES +drop event e1; +ERROR HY000: Table 'event' was not locked with LOCK TABLES +unlock tables; +lock table t1 read, mysql.event read; +show create event e1; +Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation +e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +select event_name from information_schema.events; +event_name +e1 +create event e2 on schedule every 10 hour do select 1; +ERROR HY000: Table 'event' was locked with a READ lock and can't be updated +alter event e2 disable; +ERROR HY000: Table 'event' was locked with a READ lock and can't be updated +alter event e2 rename to e3; +ERROR HY000: Table 'event' was locked with a READ lock and can't be updated +drop event e2; +ERROR HY000: Table 'event' was locked with a READ lock and can't be updated +drop event e1; +ERROR HY000: Table 'event' was locked with a READ lock and can't be updated +unlock tables; +lock table t1 write, mysql.event read; +show create event e1; +Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation +e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +select event_name from information_schema.events; +event_name +e1 +create event e2 on schedule every 10 hour do select 1; +ERROR HY000: Table 'event' was locked with a READ lock and can't be updated +alter event e2 disable; +ERROR HY000: Table 'event' was locked with a READ lock and can't be updated +alter event e2 rename to e3; +ERROR HY000: Table 'event' was locked with a READ lock and can't be updated +drop event e2; +ERROR HY000: Table 'event' was locked with a READ lock and can't be updated +drop event e1; +ERROR HY000: Table 'event' was locked with a READ lock and can't be updated +unlock tables; +lock table t1 read, mysql.event write; +ERROR HY000: You can't combine write-locking of system tables with other tables or lock types +lock table t1 write, mysql.event write; +ERROR HY000: You can't combine write-locking of system tables with other tables or lock types +lock table mysql.event write; +show create event e1; +Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation +e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +select event_name from information_schema.events; +event_name +e1 +create event e2 on schedule every 10 hour do select 1; +alter event e2 disable; +alter event e2 rename to e3; +drop event e3; +drop event e1; +unlock tables; +Make sure we have left no events +select event_name from information_schema.events; +event_name + +Events in sub-statements, events and prelocking + + +create event e1 on schedule every 10 hour do select 1; +create function f1() returns int +begin +show create event e1; +return 1; +end| +ERROR 0A000: Not allowed to return a result set from a function +create trigger trg before insert on t1 for each row +begin +show create event e1; +end| +ERROR 0A000: Not allowed to return a result set from a trigger +create function f1() returns int +begin +select event_name from information_schema.events; +return 1; +end| +ERROR 0A000: Not allowed to return a result set from a function +create trigger trg before insert on t1 for each row +begin +select event_name from information_schema.events; +end| +ERROR 0A000: Not allowed to return a result set from a trigger +create function f1() returns int +begin +create event e2 on schedule every 10 hour do select 1; +return 1; +end| +ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present +create function f1() returns int +begin +alter event e1 rename to e2; +return 1; +end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +create function f1() returns int +begin +drop event e2; +return 1; +end| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +---------------------------------------------------------------------- +create trigger trg before insert on t1 for each row +begin +set new.a= f1(); +end| +create function f1() returns int +begin +call p1(); +return 0; +end| +create procedure p1() +begin +select event_name from information_schema.events; +end| +insert into t1 (a) values (1)| +ERROR 0A000: Not allowed to return a result set from a trigger +drop procedure p1| +create procedure p1() +begin +show create event e1; +end| +insert into t1 (a) values (1)| +ERROR 0A000: Not allowed to return a result set from a trigger +drop procedure p1| +create procedure p1() +begin +create temporary table tmp select event_name from information_schema.events; +end| +expected to work, since we redirect the output into a tmp table +insert into t1 (a) values (1)| +select * from tmp| +event_name +e1 +drop temporary table tmp| +drop procedure p1| +create procedure p1() +begin +alter event e1 rename to e2; +end| +insert into t1 (a) values (1)| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +drop procedure p1| +create procedure p1() +begin +drop event e1; +end| +insert into t1 (a) values (1)| +ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +drop table t1| +drop event e1| +drop database events_test; diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index b91e7e88d64..814cf42d16c 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -722,4 +722,17 @@ DROP USER mysqltest_u1@localhost; # ##################################################################### +drop procedure if exists p; +set @old_mode= @@sql_mode; +set @@sql_mode= pow(2,32)-1; +create event e1 on schedule every 1 day do select 1; +select @@sql_mode; +@@sql_mode +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,?,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH +set @@sql_mode= @old_mode; +select replace(@full_mode, '?', 'NOT_USED') into @full_mode; +select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode; +select name from mysql.event where name = 'p' and sql_mode = @full_mode; +name +drop event e1; DROP DATABASE events_test; diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result index 033136ba354..b7d4578bede 100644 --- a/mysql-test/r/events_scheduling.result +++ b/mysql-test/r/events_scheduling.result @@ -78,11 +78,6 @@ FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='event_2'; IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') OK -SELECT IF(LAST_EXECUTED-ENDS <= 0, 'OK', 'ERROR') -FROM INFORMATION_SCHEMA.EVENTS -WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='event_2'; -IF(LAST_EXECUTED-ENDS <= 0, 'OK', 'ERROR') -OK "Already dropped because ended. Therefore an error." DROP EVENT event_3; ERROR HY000: Unknown event 'event_3' diff --git a/mysql-test/r/federated.result b/mysql-test/r/federated.result index 00287338459..b7c666dd39a 100644 --- a/mysql-test/r/federated.result +++ b/mysql-test/r/federated.result @@ -14,6 +14,9 @@ Warnings: Note 1051 Unknown table 't1' CREATE TABLE federated.t1 ( `id` int(20) NOT NULL, +`group` int NOT NULL default 0, +`a\\b` int NOT NULL default 0, +`a\\` int NOT NULL default 0, `name` varchar(32) NOT NULL default '' ) DEFAULT CHARSET=latin1; @@ -22,6 +25,9 @@ Warnings: Note 1051 Unknown table 't1' CREATE TABLE federated.t1 ( `id` int(20) NOT NULL, +`group` int NOT NULL default 0, +`a\\b` inT NOT NULL default 0, +`a\\` int NOT NULL default 0, `name` varchar(32) NOT NULL default '' ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 @@ -29,6 +35,9 @@ CONNECTION='mysql://root@127.0.0.1:@/too/many/items/federated/t1'; ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@127.0.0.1:@/too/many/items/federated/t1' is not in the correct format CREATE TABLE federated.t1 ( `id` int(20) NOT NULL, +`group` int NOT NULL default 0, +`a\\b` iNt NOT NULL default 0, +`a\\` int NOT NULL default 0, `name` varchar(32) NOT NULL default '' ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 @@ -36,6 +45,9 @@ CONNECTION='mysql://root@127.0.0.1'; ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@127.0.0.1' is not in the correct format CREATE TABLE federated.t1 ( `id` int(20) NOT NULL, +`group` int NOT NULL default 0, +`a\\b` iNT NOT NULL default 0, +`a\\` int NOT NULL default 0, `name` varchar(32) NOT NULL default '' ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 @@ -45,6 +57,9 @@ ERROR HY000: The foreign data source you are trying to reference does not exist. DROP TABLE federated.t1; CREATE TABLE federated.t1 ( `id` int(20) NOT NULL, +`group` int NOT NULL default 0, +`a\\b` Int NOT NULL default 0, +`a\\` int NOT NULL default 0, `name` varchar(32) NOT NULL default '' ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 @@ -54,16 +69,25 @@ ERROR HY000: Unable to connect to foreign data source: Access denied for user 'u DROP TABLE federated.t1; CREATE TABLE federated.t1 ( `id` int(20) NOT NULL, +`group` int NOT NULL default 0, +`a\\b` InT NOT NULL default 0, +`a\\` int NOT NULL default 0, `name` varchar(32) NOT NULL default '' ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); +INSERT INTO federated.t1 (id, `group`) VALUES (3, 42); +INSERT INTO federated.t1 (id, `a\\b`) VALUES (4, 23); +INSERT INTO federated.t1 (id, `a\\`) VALUES (5, 1); SELECT * FROM federated.t1; -id name -1 foo -2 fee +id group a\\b a\\ name +1 0 0 0 foo +2 0 0 0 fee +3 42 0 0 +4 0 23 0 +5 0 0 1 DELETE FROM federated.t1; DROP TABLE federated.t1; DROP TABLE IF EXISTS federated.t2; @@ -2066,6 +2090,34 @@ select 1 from t1 order by a; drop table t1; drop table t1; drop view v1; +CREATE TABLE t1 (a INT, b INT, KEY(a,b)); +INSERT INTO t1 VALUES(NULL,1),(1,NULL),(NULL,NULL),(1,1),(2,2); +CREATE TABLE t1 (a INT, b INT, KEY(a,b)) ENGINE=federated +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; +SELECT * FROM t1 WHERE a IS NULL; +a b +NULL NULL +NULL 1 +SELECT * FROM t1 WHERE a IS NOT NULL; +a b +1 NULL +1 1 +2 2 +SELECT * FROM t1 WHERE a=1 AND b=1; +a b +1 1 +SELECT * FROM t1 WHERE a IS NULL AND b=1; +a b +NULL 1 +SELECT * FROM t1 WHERE a IS NOT NULL AND b=1; +a b +1 1 +DROP TABLE t1; +DROP TABLE t1; +CREATE TABLE t1 (a INT) ENGINE=federated CONNECTION='mysql://@:://'; +DROP TABLE t1; +create server 's1' foreign data wrapper 'mysql' options (port 3306); +drop server 's1'; End of 5.1 tests DROP TABLE IF EXISTS federated.t1; DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result index f1b6c471943..b978304f59d 100644 --- a/mysql-test/r/flush.result +++ b/mysql-test/r/flush.result @@ -72,6 +72,7 @@ flush tables with read lock; unlock tables; drop table t1, t2; set session low_priority_updates=default; +select benchmark(200, (select sin(1))) > 1000; End of 5.0 tests set @old_general_log= @@general_log; set @old_read_only= @@read_only; diff --git a/mysql-test/r/flush_read_lock_kill.result b/mysql-test/r/flush_read_lock_kill.result index 6703b6bd533..0b599f343f7 100644 --- a/mysql-test/r/flush_read_lock_kill.result +++ b/mysql-test/r/flush_read_lock_kill.result @@ -1,3 +1,5 @@ +set @old_concurrent_insert= @@global.concurrent_insert; +set @@global.concurrent_insert= 0; drop table if exists t1; create table t1 (kill_id int); insert into t1 values(connection_id()); @@ -7,3 +9,4 @@ select ((@id := kill_id) - kill_id) from t1; 0 kill connection @id; drop table t1; +set @@global.concurrent_insert= @old_concurrent_insert; diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index c3fa427127b..2fc00073448 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -17,7 +17,7 @@ explain extended select * from t1 where MATCH(a,b) AGAINST ("collections"); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 fulltext a a 0 1 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against (_latin1'collections')) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('collections')) select * from t1 where MATCH(a,b) AGAINST ("indexes"); a b Full-text indexes are called collections @@ -87,7 +87,7 @@ explain extended select * from t1 where MATCH(a,b) AGAINST("support -collections id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 fulltext a a 0 1 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against (_latin1'support -collections' in boolean mode)) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('support -collections' in boolean mode)) select * from t1 where MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE); a b MySQL has now support for full-text search diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result index 32377c9ba63..25b921681c5 100644 --- a/mysql-test/r/func_crypt.result +++ b/mysql-test/r/func_crypt.result @@ -91,7 +91,7 @@ explain extended select password('idkfa '), old_password('idkfa'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select password(_latin1'idkfa ') AS `password('idkfa ')`,old_password(_latin1'idkfa') AS `old_password('idkfa')` +Note 1003 select password('idkfa ') AS `password('idkfa ')`,old_password('idkfa') AS `old_password('idkfa')` select encrypt('1234','_.'); encrypt('1234','_.') # diff --git a/mysql-test/r/func_encrypt.result b/mysql-test/r/func_encrypt.result index dc2b5498b2a..04af76429f8 100644 --- a/mysql-test/r/func_encrypt.result +++ b/mysql-test/r/func_encrypt.result @@ -182,4 +182,4 @@ explain extended select des_decrypt(des_encrypt("hello",4),'password2'), des_dec id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select des_decrypt(des_encrypt(_latin1'hello',4),_latin1'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt(_latin1'hello',_latin1'hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))` +Note 1003 select des_decrypt(des_encrypt('hello',4),'password2') AS `des_decrypt(des_encrypt("hello",4),'password2')`,des_decrypt(des_encrypt('hello','hidden')) AS `des_decrypt(des_encrypt("hello","hidden"))` diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index b5bfadf1f57..04f83788571 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -937,4 +937,19 @@ SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY b) FROM t1; GROUP_CONCAT(DISTINCT b, a ORDER BY b) 11,22,32 DROP TABLE t1, t2, t3; +CREATE TABLE t1(a INT); +INSERT INTO t1 VALUES (),(); +SELECT s1.d1 FROM +( +SELECT +t1.a as d1, +GROUP_CONCAT(DISTINCT t1.a) AS d2 +FROM +t1 AS t1, +t1 AS t2 +GROUP BY 1 +) AS s1; +d1 +NULL +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 4c1abb160c6..c198176532f 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1410,4 +1410,10 @@ Note 1003 select (`test`.`t1`.`a` + 1) AS `y` from `test`.`t1` group by (`test`. DROP VIEW v1; DROP TABLE t1; SET SQL_MODE=DEFAULT; +CREATE TABLE t1(a DOUBLE); +INSERT INTO t1 VALUES (10), (20); +SELECT AVG(a), CAST(AVG(a) AS DECIMAL) FROM t1; +AVG(a) CAST(AVG(a) AS DECIMAL) +15 15 +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index e9a17324397..42a2aa840ea 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -43,7 +43,7 @@ explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 100.00 Using where; Using filesort Warnings: -Note 1003 select if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) AS `s` from `test`.`t1` where (`test`.`t1`.`st` like _latin1'%a%') order by if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) +Note 1003 select if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) AS `s` from `test`.`t1` where (`test`.`t1`.`st` like '%a%') order by if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,cast(`test`.`t1`.`st` as char charset binary)) select nullif(u, 1) from t1; nullif(u, 1) NULL diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 80fa8f17a2a..6e1f9bd8188 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -146,7 +146,7 @@ explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (_latin1'a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,(`test`.`t1`.`c` collate latin1_bin))) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ('a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,(`test`.`t1`.`c` collate latin1_bin))) drop table t1; set names utf8; create table t1 (a char(10) character set utf8 not null); diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result index 5de5962efeb..9338a76e320 100644 --- a/mysql-test/r/func_like.result +++ b/mysql-test/r/func_like.result @@ -5,12 +5,12 @@ explain extended select * from t1 where a like 'abc%'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index a a 13 NULL 5 20.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like _latin1'abc%') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like 'abc%') explain extended select * from t1 where a like concat('abc','%'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index a a 13 NULL 5 20.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like concat(_latin1'abc',_latin1'%')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like concat('abc','%')) select * from t1 where a like "abc%"; a abc diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 6a476d12896..b4a07f18521 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -408,3 +408,22 @@ a DIV 2 0 DROP TABLE t1; End of 5.0 tests +SELECT 1e308 + 1e308; +1e308 + 1e308 +NULL +SELECT -1e308 - 1e308; +-1e308 - 1e308 +NULL +SELECT 1e300 * 1e300; +1e300 * 1e300 +NULL +SELECT 1e300 / 1e-300; +1e300 / 1e-300 +NULL +SELECT EXP(750); +EXP(750) +NULL +SELECT POW(10, 309); +POW(10, 309) +NULL +End of 5.1 tests diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 745a340ec94..a6b912b4e0a 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -212,6 +212,25 @@ test SELECT NAME_CONST('test', 'test'); test test +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT NAME_CONST('flag',1) * MAX(a) FROM t1; +NAME_CONST('flag',1) * MAX(a) +3 +SELECT NAME_CONST('flag',1.5) * MAX(a) FROM t1; +NAME_CONST('flag',1.5) * MAX(a) +4.5 +SELECT NAME_CONST('flag',-1) * MAX(a) FROM t1; +NAME_CONST('flag',-1) * MAX(a) +-3 +SELECT NAME_CONST('flag',-1.5) * MAX(a) FROM t1; +NAME_CONST('flag',-1.5) * MAX(a) +-4.5 +SELECT NAME_CONST('flag', SQRT(4)) * MAX(a) FROM t1; +ERROR HY000: Incorrect arguments to NAME_CONST +SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1; +ERROR HY000: Incorrect arguments to NAME_CONST +DROP TABLE t1; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (5), (2); SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t; @@ -230,6 +249,9 @@ select min(a) from t1 group by inet_ntoa(a); min(a) -2 drop table t1; +SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs; +NAME_CONST('var', 'value') COLLATE latin1_general_cs +value End of 5.0 tests select connection_id() > 0; connection_id() > 0 diff --git a/mysql-test/r/func_regexp.result b/mysql-test/r/func_regexp.result index 9d85b1d3e7f..794ae79973a 100644 --- a/mysql-test/r/func_regexp.result +++ b/mysql-test/r/func_regexp.result @@ -52,7 +52,7 @@ explain extended select * from t1 where xxx regexp('is a test of some long text id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select 'this is a test of some long text to see what happens' AS `xxx` from `test`.`t1` where ('this is a test of some long text to see what happens' regexp _latin1'is a test of some long text to') +Note 1003 select 'this is a test of some long text to see what happens' AS `xxx` from `test`.`t1` where ('this is a test of some long text to see what happens' regexp 'is a test of some long text to') select * from t1 where xxx regexp('is a test of some long text to '); xxx this is a test of some long text to see what happens diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result index 4dd11cafdcd..3f9f7b85731 100644 --- a/mysql-test/r/func_set.result +++ b/mysql-test/r/func_set.result @@ -5,7 +5,7 @@ explain extended select INTERVAL(55,10,20,30,40,50,60,70,80,90,100),interval(3,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 select interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field(_latin1'IBM',_latin1'NCA',_latin1'ICL',_latin1'SUN',_latin1'IBM',_latin1'DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field(_latin1'A',_latin1'B',_latin1'C') AS `field("A","B","C")`,elt(2,_latin1'ONE',_latin1'TWO',_latin1'THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0` +Note 1003 select interval((55,10,20,30,40,50,60,70,80,90,100)) AS `INTERVAL(55,10,20,30,40,50,60,70,80,90,100)`,interval((3,1,(1 + 1),(((1 + 1) + 1) + 1))) AS `interval(3,1,1+1,1+1+1+1)`,field('IBM','NCA','ICL','SUN','IBM','DIGITAL') AS `field("IBM","NCA","ICL","SUN","IBM","DIGITAL")`,field('A','B','C') AS `field("A","B","C")`,elt(2,'ONE','TWO','THREE') AS `elt(2,"ONE","TWO","THREE")`,interval((0,1,2,3,4)) AS `interval(0,1,2,3,4)`,(elt(1,1,2,3) | 0) AS `elt(1,1,2,3)|0`,(elt(1,1.1,1.2,1.3) + 0) AS `elt(1,1.1,1.2,1.3)+0` SELECT INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56); INTERVAL(13, 7, 14, 21, 28, 35, 42, 49, 56) 1 diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 6f6edd5112b..78748a4622f 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -817,57 +817,57 @@ explain extended select md5('hello'); 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 md5(_latin1'hello') AS `md5('hello')` +Note 1003 select md5('hello') AS `md5('hello')` explain extended select sha('abc'); 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 sha(_latin1'abc') AS `sha('abc')` +Note 1003 select sha('abc') AS `sha('abc')` explain extended select sha1('abc'); 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 sha(_latin1'abc') AS `sha1('abc')` +Note 1003 select sha('abc') AS `sha1('abc')` explain extended select soundex(''); 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 soundex(_latin1'') AS `soundex('')` +Note 1003 select soundex('') AS `soundex('')` explain extended select 'mood' sounds like 'mud'; 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 (soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'` +Note 1003 select (soundex('mood') = soundex('mud')) AS `'mood' sounds like 'mud'` explain extended select aes_decrypt(aes_encrypt('abc','1'),'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 select aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')` +Note 1003 select aes_decrypt(aes_encrypt('abc','1'),'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')` explain extended select concat('*',space(5),'*'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')` +Note 1003 select concat('*',repeat(' ',5),'*') AS `concat('*',space(5),'*')` explain extended select reverse('abc'); 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 reverse(_latin1'abc') AS `reverse('abc')` +Note 1003 select reverse('abc') AS `reverse('abc')` explain extended select rpad('a',4,'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 select rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')` +Note 1003 select rpad('a',4,'1') AS `rpad('a',4,'1')` explain extended select lpad('a',4,'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 select lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')` +Note 1003 select lpad('a',4,'1') AS `lpad('a',4,'1')` explain extended select concat_ws(',','',NULL,'a'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')` +Note 1003 select concat_ws(',','',NULL,'a') AS `concat_ws(',','',NULL,'a')` explain extended select make_set(255,_latin2'a', _latin2'b', _latin2'c'); 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 @@ -882,7 +882,7 @@ explain extended select locate("a","b",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 select locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)` +Note 1003 select locate('a','b',2) AS `locate("a","b",2)` explain extended select format(130,10); 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 @@ -907,7 +907,7 @@ explain extended select binary 'HE'; 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(_latin1'HE' as char charset binary) AS `binary 'HE'` +Note 1003 select cast('HE' as char charset binary) AS `binary 'HE'` explain extended select export_set(255,_latin2'y', _latin2'n', _latin2' '); 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 @@ -917,7 +917,7 @@ explain extended select FIELD('b' COLLATE latin1_bin,'A','B'); 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 field((_latin1'b' collate latin1_bin),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')` +Note 1003 select field(('b' collate latin1_bin),'A','B') AS `FIELD('b' COLLATE latin1_bin,'A','B')` explain extended select FIND_IN_SET(_latin1'B', _latin1'a,b,c,d'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used @@ -937,37 +937,37 @@ explain extended select length('\n\t\r\b\0\_\%\\'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')` +Note 1003 select length('\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')` explain extended select bit_length('\n\t\r\b\0\_\%\\'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')` +Note 1003 select bit_length('\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')` explain extended select bit_length('\n\t\r\b\0\_\%\\'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')` +Note 1003 select bit_length('\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')` explain extended select concat('monty',' was here ','again'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')` +Note 1003 select concat('monty',' was here ','again') AS `concat('monty',' was here ','again')` explain extended select length('hello'); 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 length(_latin1'hello') AS `length('hello')` +Note 1003 select length('hello') AS `length('hello')` explain extended select char(ascii('h')); 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 char(ascii(_latin1'h')) AS `char(ascii('h'))` +Note 1003 select char(ascii('h')) AS `char(ascii('h'))` explain extended select ord('h'); 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 ord(_latin1'h') AS `ord('h')` +Note 1003 select ord('h') AS `ord('h')` explain extended select quote(1/0); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used @@ -977,17 +977,17 @@ explain extended select crc32("123"); 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 crc32(_latin1'123') AS `crc32("123")` +Note 1003 select crc32('123') AS `crc32("123")` explain extended select replace('aaaa','a','b'); 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 replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')` +Note 1003 select replace('aaaa','a','b') AS `replace('aaaa','a','b')` explain extended select insert('txs',2,1,'hi'); 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 insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')` +Note 1003 select insert('txs',2,1,'hi') AS `insert('txs',2,1,'hi')` explain extended select left(_latin2'a',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 @@ -1012,12 +1012,12 @@ explain extended select SUBSTR('abcdefg',3,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 select substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)` +Note 1003 select substr('abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)` explain extended select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 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 select substring_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)` +Note 1003 select substring_index('1abcd;2abcd;3abcd;4abcd',';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)` explain extended select trim(_latin2' a '); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used @@ -1037,7 +1037,7 @@ explain extended select decode(encode(repeat("a",100000),"monty"),"monty"); 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 decode(encode(repeat(_latin1'a',100000),_latin1'monty'),_latin1'monty') AS `decode(encode(repeat("a",100000),"monty"),"monty")` +Note 1003 select decode(encode(repeat('a',100000),'monty'),'monty') AS `decode(encode(repeat("a",100000),"monty"),"monty")` SELECT lpad(12345, 5, "#"); lpad(12345, 5, "#") 12345 @@ -1282,39 +1282,39 @@ EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(`test`.`t1`.`s`) > _latin1'ab') +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(`test`.`t1`.`s`) > 'ab') EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both _latin1'y' from `test`.`t1`.`s`) > _latin1'ab') +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both 'y' from `test`.`t1`.`s`) > 'ab') EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(leading _latin1'y' from `test`.`t1`.`s`) > _latin1'ab') +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(leading 'y' from `test`.`t1`.`s`) > 'ab') EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(trailing _latin1'y' from `test`.`t1`.`s`) > _latin1'ab') +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(trailing 'y' from `test`.`t1`.`s`) > 'ab') EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both _latin1'y' from `test`.`t1`.`s`) > _latin1'ab') +Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both 'y' from `test`.`t1`.`s`) > 'ab') DROP TABLE t1; create table t1(f1 varchar(4)); explain extended select encode(f1,'zxcv') as 'enc' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select encode('',_latin1'zxcv') AS `enc` from `test`.`t1` +Note 1003 select encode('','zxcv') AS `enc` from `test`.`t1` explain extended select decode(f1,'zxcv') as 'enc' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select decode('',_latin1'zxcv') AS `enc` from `test`.`t1` +Note 1003 select decode('','zxcv') AS `enc` from `test`.`t1` drop table t1; create table t1 (a bigint not null)engine=myisam; insert into t1 set a = 1024*1024*1024*4; @@ -1390,7 +1390,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 const PRIMARY PRIMARY 12 const 1 100.00 Using index 1 SIMPLE t1 ref code code 13 const 3 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5)) +Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = 'a12') and (length(`test`.`t1`.`code`) = 5)) DROP TABLE t1,t2; select encode(NULL, NULL); encode(NULL, NULL) @@ -1431,6 +1431,11 @@ benchmark(100, NULL) select benchmark(NULL, 1+1); benchmark(NULL, 1+1) NULL +select benchmark(-1, 1); +benchmark(-1, 1) +NULL +Warnings: +Error 1411 Incorrect count value: '-1' for function benchmark set @password="password"; set @my_data="clear text to encode"; select md5(encode(@my_data, "password")); diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 4dd8fb1531d..cc0fb88b791 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -666,6 +666,8 @@ timestampadd(SQL_TSI_SECOND, 1, date) select timestampadd(SQL_TSI_FRAC_SECOND, 1, date) from t1; timestampadd(SQL_TSI_FRAC_SECOND, 1, date) 2003-01-02 00:00:00.000001 +Warnings: +Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead select timestampdiff(MONTH, '2001-02-01', '2001-05-01') as a; a 3 @@ -699,6 +701,8 @@ a select timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12:58:58.119999') as a; a 7689538999999 +Warnings: +Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead select timestampdiff(SQL_TSI_DAY, '1986-02-01', '1986-03-01') as a1, timestampdiff(SQL_TSI_DAY, '1900-02-01', '1900-03-01') as a2, timestampdiff(SQL_TSI_DAY, '1996-02-01', '1996-03-01') as a3, @@ -839,7 +843,7 @@ explain extended select period_add("9602",-12),period_diff(199505,"9404"),from_d id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select period_add(_latin1'9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,_latin1'9404') AS `period_diff(199505,"9404")`,from_days(to_days(_latin1'960101')) AS `from_days(to_days("960101"))`,dayofmonth(_latin1'1997-01-02') AS `dayofmonth("1997-01-02")`,month(_latin1'1997-01-02') AS `month("1997-01-02")`,monthname(_latin1'1972-03-04') AS `monthname("1972-03-04")`,dayofyear(_latin1'0000-00-00') AS `dayofyear("0000-00-00")`,hour(_latin1'1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute(_latin1'23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week(_latin1'1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek(_latin1'2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year(_latin1'98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname(_latin1'1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec(_latin1'0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format(_latin1'1997-01-02 03:04:05',_latin1'%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp(_latin1'1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,(_latin1'1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,(_latin1'1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from _latin1'1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,(_latin1'1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)` +Note 1003 select period_add('9602',-(12)) AS `period_add("9602",-12)`,period_diff(199505,'9404') AS `period_diff(199505,"9404")`,from_days(to_days('960101')) AS `from_days(to_days("960101"))`,dayofmonth('1997-01-02') AS `dayofmonth("1997-01-02")`,month('1997-01-02') AS `month("1997-01-02")`,monthname('1972-03-04') AS `monthname("1972-03-04")`,dayofyear('0000-00-00') AS `dayofyear("0000-00-00")`,hour('1997-03-03 23:03:22') AS `HOUR("1997-03-03 23:03:22")`,minute('23:03:22') AS `MINUTE("23:03:22")`,second(230322) AS `SECOND(230322)`,quarter(980303) AS `QUARTER(980303)`,week('1998-03-03',0) AS `WEEK("1998-03-03")`,yearweek('2000-01-01',1) AS `yearweek("2000-01-01",1)`,week(19950101,1) AS `week(19950101,1)`,year('98-02-03') AS `year("98-02-03")`,(weekday(curdate()) - weekday(now())) AS `weekday(curdate())-weekday(now())`,dayname('1962-03-03') AS `dayname("1962-03-03")`,unix_timestamp() AS `unix_timestamp()`,sec_to_time((time_to_sec('0:30:47') / 6.21)) AS `sec_to_time(time_to_sec("0:30:47")/6.21)`,curtime() AS `curtime()`,utc_time() AS `utc_time()`,curdate() AS `curdate()`,utc_date() AS `utc_date()`,utc_timestamp() AS `utc_timestamp()`,date_format('1997-01-02 03:04:05','%M %W %D %Y %y %m %d %h %i %s %w') AS `date_format("1997-01-02 03:04:05", "%M %W %D %Y %y %m %d %h %i %s %w")`,from_unixtime(unix_timestamp('1994-03-02 10:11:12')) AS `from_unixtime(unix_timestamp("1994-03-02 10:11:12"))`,('1997-12-31 23:59:59' + interval 1 second) AS `"1997-12-31 23:59:59" + INTERVAL 1 SECOND`,('1998-01-01 00:00:00' - interval 1 second) AS `"1998-01-01 00:00:00" - INTERVAL 1 SECOND`,('1997-12-31' + interval 1 day) AS `INTERVAL 1 DAY + "1997-12-31"`,extract(year from '1999-01-02 10:11:12') AS `extract(YEAR FROM "1999-01-02 10:11:12")`,('1997-12-31 23:59:59' + interval 1 second) AS `date_add("1997-12-31 23:59:59",INTERVAL 1 SECOND)` SET @TMP='2007-08-01 12:22:49'; CREATE TABLE t1 (d DATETIME); INSERT INTO t1 VALUES ('2007-08-01 12:22:59'); @@ -1069,7 +1073,8 @@ timestampdiff(SQL_TSI_FRAC_SECOND, '2001-02-01 12:59:59.120000', '2001-05-01 12: 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 timestampdiff(WEEK,_latin1'2001-02-01',_latin1'2001-05-01') AS `a1`,timestampdiff(SECOND_FRAC,_latin1'2001-02-01 12:59:59.120000',_latin1'2001-05-01 12:58:58.119999') AS `a2` +Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead +Note 1003 select timestampdiff(WEEK,'2001-02-01','2001-05-01') AS `a1`,timestampdiff(SECOND_FRAC,'2001-02-01 12:59:59.120000','2001-05-01 12:58:58.119999') AS `a2` select time_format('100:00:00', '%H %k %h %I %l'); time_format('100:00:00', '%H %k %h %I %l') 100 100 04 04 4 @@ -1261,6 +1266,24 @@ DATE_ADD(20071108, INTERVAL 1 DAY) select LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND; LAST_DAY('2007-12-06 08:59:19.05') - INTERVAL 1 SECOND 2007-12-30 23:59:59 +SELECT TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18'); +TIMESTAMPADD(FRAC_SECOND, 1, '2008-02-18') +2008-02-18 00:00:00.000001 +Warnings: +Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead +SELECT TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18'); +TIMESTAMPDIFF(FRAC_SECOND, '2008-02-17', '2008-02-18') +86400000000 +Warnings: +Warning 1287 The syntax 'FRAC_SECOND' is deprecated and will be removed in MySQL 6.2. Please use MICROSECOND instead +SELECT DATE_ADD('2008-02-18', INTERVAL 1 FRAC_SECOND); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRAC_SECOND)' at line 1 +SELECT DATE_SUB('2008-02-18', INTERVAL 1 FRAC_SECOND); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRAC_SECOND)' at line 1 +SELECT '2008-02-18' + INTERVAL 1 FRAC_SECOND; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRAC_SECOND' at line 1 +SELECT '2008-02-18' - INTERVAL 1 FRAC_SECOND; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FRAC_SECOND' at line 1 End of 5.0 tests select date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND); date_sub("0050-01-01 00:00:01",INTERVAL 2 SECOND) diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 73fb9cc69e0..d91e21e9399 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -439,12 +439,12 @@ explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4 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 astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))` +Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))` explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)')))); 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 astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))` +Note 1003 select astext(geometryfromwkb(aswkb(geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))` SELECT SRID(GeomFromText('LineString(1 1,2 2)',101)); SRID(GeomFromText('LineString(1 1,2 2)',101)) 101 @@ -452,7 +452,7 @@ explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101)); 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 srid(geometryfromtext(_latin1'LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))` +Note 1003 select srid(geometryfromtext('LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))` explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 0df3ac6de8a..a56cce50259 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1218,6 +1218,28 @@ DROP USER mysqltest_1@localhost; DROP DATABASE db27878; use test; DROP TABLE t1; +drop table if exists test; +Warnings: +Note 1051 Unknown table 'test' +drop function if exists test_function; +Warnings: +Note 1305 FUNCTION test_function does not exist +drop view if exists v1; +Warnings: +Note 1051 Unknown table 'test.v1' +create table test (col1 varchar(30)); +create function test_function() returns varchar(30) +begin +declare tmp varchar(30); +select col1 from test limit 1 into tmp; +return '1'; +end| +create view v1 as select test.* from test where test.col1=test_function(); +grant update (col1) on v1 to 'greg'@'localhost'; +drop user 'greg'@'localhost'; +drop view v1; +drop table test; +drop function test_function; End of 5.0 tests set names utf8; grant select on test.* to юзер_юзер@localhost; @@ -1282,5 +1304,45 @@ CALL mysqltest1.test(); 1 DROP DATABASE mysqltest1; RENAME TABLE mysql.procs_gone TO mysql.procs_priv; +DROP USER mysqltest_1@localhost; FLUSH PRIVILEGES; +CREATE DATABASE dbbug33464; +CREATE USER 'userbug33464'@'localhost'; +GRANT CREATE ROUTINE ON dbbug33464.* TO 'userbug33464'@'localhost'; + +userbug33464@localhost dbbug33464 +DROP PROCEDURE IF EXISTS sp3; +DROP FUNCTION IF EXISTS fn1; +CREATE PROCEDURE sp3(v1 char(20)) +BEGIN +SELECT * from dbbug33464.t6 where t6.f2= 'xyz'; +END// +CREATE FUNCTION fn1() returns char(50) SQL SECURITY INVOKER +BEGIN +return 1; +END// +CREATE FUNCTION fn2() returns char(50) SQL SECURITY DEFINER +BEGIN +return 2; +END// +USE dbbug33464; + +root@localhost dbbug33464 +SELECT fn1(); +fn1() +1 +SELECT fn2(); +fn2() +2 +DROP USER 'userbug33464'@'localhost'; +DROP FUNCTION fn1; +Warnings: +Warning 1403 There is no such grant defined for user 'userbug33464' on host 'localhost' on routine 'fn1' +DROP FUNCTION fn2; +Warnings: +Warning 1403 There is no such grant defined for user 'userbug33464' on host 'localhost' on routine 'fn2' +DROP PROCEDURE sp3; +DROP USER 'userbug33464'@'localhost'; +use test; +DROP DATABASE dbbug33464; End of 5.1 tests diff --git a/mysql-test/r/grant3.result b/mysql-test/r/grant3.result index cc7f46855b2..f38848111ad 100644 --- a/mysql-test/r/grant3.result +++ b/mysql-test/r/grant3.result @@ -138,3 +138,20 @@ SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by user host db select_priv DROP USER CUser2@localhost; DROP USER CUser2@LOCALHOST; +CREATE DATABASE mysqltest_1; +CREATE TABLE mysqltest_1.t1 (a INT); +CREATE USER 'mysqltest1'@'%'; +GRANT SELECT, UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%'; +REVOKE SELECT ON `mysqltest_1`.* FROM 'mysqltest1'@'%'; +GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%'; +FLUSH PRIVILEGES; +SHOW GRANTS; +Grants for mysqltest1@% +GRANT USAGE ON *.* TO 'mysqltest1'@'%' +GRANT SELECT, UPDATE ON `mysqltest\_1`.* TO 'mysqltest1'@'%' +GRANT UPDATE ON `mysqltest_1`.* TO 'mysqltest1'@'%' +SELECT * FROM mysqltest_1.t1; +a +DROP USER 'mysqltest1'@'%'; +DROP DATABASE mysqltest_1; +End of 5.0 tests diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 268f290ddca..30c4d1e4ca1 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1128,6 +1128,152 @@ id c1 c2 4 2 3 1 5 1 DROP TABLE t1; +# +# Bug#27219: Aggregate functions in ORDER BY. +# +SET @save_sql_mode=@@sql_mode; +SET @@sql_mode='ONLY_FULL_GROUP_BY'; +CREATE TABLE t1 (a INT, b INT, c INT DEFAULT 0); +INSERT INTO t1 (a, b) VALUES (3,3), (2,2), (3,3), (2,2), (3,3), (4,4); +CREATE TABLE t2 SELECT * FROM t1; +SELECT 1 FROM t1 ORDER BY COUNT(*); +1 +1 +SELECT 1 FROM t1 ORDER BY COUNT(*) + 1; +1 +1 +SELECT 1 FROM t1 ORDER BY COUNT(*) + a; +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT 1 FROM t1 ORDER BY COUNT(*), 1; +1 +1 +SELECT 1 FROM t1 ORDER BY COUNT(*), a; +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT 1 FROM t1 ORDER BY SUM(a); +1 +1 +SELECT 1 FROM t1 ORDER BY SUM(a + 1); +1 +1 +SELECT 1 FROM t1 ORDER BY SUM(a) + 1; +1 +1 +SELECT 1 FROM t1 ORDER BY SUM(a), b; +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT a FROM t1 ORDER BY COUNT(b); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2); +a +3 +2 +3 +2 +3 +4 +SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a), t2.a FROM t2); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 ORDER BY (SELECT SUM(t2.a) FROM t2 ORDER BY t2.a); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 ORDER BY (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 +WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.b) LIMIT 1); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 GROUP BY t1.a +HAVING t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t2.a) LIMIT 1); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 GROUP BY t1.a +HAVING t1.a IN (SELECT t2.a FROM t2 ORDER BY SUM(t1.b)); +a +2 +3 +4 +SELECT t1.a FROM t1 GROUP BY t1.a +HAVING t1.a IN (SELECT t2.a FROM t2 ORDER BY t2.a, SUM(t2.b)); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 GROUP BY t1.a +HAVING t1.a > ANY (SELECT t2.a FROM t2 ORDER BY t2.a, SUM(t2.b)); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 +WHERE t1.a = (SELECT t2.a FROM t2 ORDER BY SUM(t1.b)); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT 1 FROM t1 GROUP BY t1.a +HAVING (SELECT AVG(SUM(t1.b) + 1) FROM t2 ORDER BY SUM(t2.a) LIMIT 1); +1 +1 +1 +1 +SELECT 1 FROM t1 GROUP BY t1.a +HAVING (SELECT AVG(SUM(t1.b) + t2.b) FROM t2 ORDER BY SUM(t2.a) LIMIT 1); +1 +1 +1 +1 +SELECT 1 FROM t1 GROUP BY t1.a +HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY SUM(t2.a) LIMIT 1); +1 +1 +1 +1 +SELECT 1 FROM t1 GROUP BY t1.a +HAVING (SELECT AVG(SUM(t1.b) + 1) FROM t2 ORDER BY t2.a LIMIT 1); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT 1 FROM t1 GROUP BY t1.a +HAVING (SELECT AVG(SUM(t1.b) + t2.b) FROM t2 ORDER BY t2.a LIMIT 1); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT 1 FROM t1 GROUP BY t1.a +HAVING (SELECT AVG(t1.b + t2.b) FROM t2 ORDER BY t2.a LIMIT 1); +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +SELECT t1.a FROM t1 +WHERE t1.a = (SELECT t2.a FROM t2 GROUP BY t2.a +ORDER BY SUM(t2.b), SUM(t1.b) LIMIT 1); +a +4 +SELECT t1.a, SUM(t1.b) FROM t1 +WHERE t1.a = (SELECT SUM(t2.b) FROM t2 GROUP BY t2.a +ORDER BY SUM(t2.b), SUM(t1.b) LIMIT 1) +GROUP BY t1.a; +a SUM(t1.b) +4 4 +SELECT t1.a, SUM(t1.b) FROM t1 +WHERE t1.a = (SELECT SUM(t2.b) FROM t2 +ORDER BY SUM(t2.b) + SUM(t1.b) LIMIT 1) +GROUP BY t1.a; +a SUM(t1.b) +SELECT t1.a, SUM(t1.b) FROM t1 +WHERE t1.a = (SELECT SUM(t2.b) FROM t2 +ORDER BY SUM(t2.b + t1.a) LIMIT 1) +GROUP BY t1.a; +a SUM(t1.b) +SELECT t1.a FROM t1 GROUP BY t1.a +HAVING (1, 1) = (SELECT SUM(t1.a), t1.a FROM t2 LIMIT 1); +a +select avg ( +(select +(select sum(outr.a + innr.a) from t1 as innr limit 1) as tt +from t1 as outr order by outr.a limit 1)) +from t1 as most_outer; +avg ( +(select +(select sum(outr.a + innr.a) from t1 as innr limit 1) as tt +from t1 as outr order by outr.a limit 1)) +29.0000 +select avg ( +(select ( +(select sum(outr.a + innr.a) from t1 as innr limit 1)) as tt +from t1 as outr order by count(outr.a) limit 1)) as tt +from t1 as most_outer; +ERROR 42000: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause +select (select sum(outr.a + t1.a) from t1 limit 1) as tt from t1 as outr order by outr.a; +tt +29 +29 +35 +35 +35 +41 +SET sql_mode=@save_sql_mode; +DROP TABLE t1, t2; End of 5.0 tests CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index 103a7f5515a..bdc8d586f4e 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -1562,7 +1562,7 @@ explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 50.78 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`c` = _latin1'i121') and (`test`.`t1`.`b` = _latin1'a') and (`test`.`t1`.`a2` >= _latin1'b')) +Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`c` = 'i121') and (`test`.`t1`.`b` = 'a') and (`test`.`t1`.`a2` >= 'b')) explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-by @@ -1579,7 +1579,7 @@ explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 50.61 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = _latin1'i121') and (`test`.`t2`.`b` = _latin1'a') and (`test`.`t2`.`a2` >= _latin1'b')) +Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 'i121') and (`test`.`t2`.`b` = 'a') and (`test`.`t2`.`a2` >= 'b')) explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by @@ -1808,7 +1808,7 @@ explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index Warnings: -Note 1003 select count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`b` = _latin1'c') and (`test`.`t1`.`a1` > _latin1'a') and (`test`.`t1`.`a2` > _latin1'a')) +Note 1003 select count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`) AS `count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`b` = 'c') and (`test`.`t1`.`a1` > 'a') and (`test`.`t1`.`a2` > 'a')) explain select count(distinct b) from t1 where (a2 >= 'b') and (b = 'a'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index @@ -1816,7 +1816,7 @@ explain extended select ord(a1) + count(distinct a1,a2,b) from t1 where (a1 > 'a id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index Warnings: -Note 1003 select (ord(`test`.`t1`.`a1`) + count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`)) AS `ord(a1) + count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`a1` > _latin1'a') and (`test`.`t1`.`a2` > _latin1'a')) +Note 1003 select (ord(`test`.`t1`.`a1`) + count(distinct `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`)) AS `ord(a1) + count(distinct a1,a2,b)` from `test`.`t1` where ((`test`.`t1`.`a1` > 'a') and (`test`.`t1`.`a2` > 'a')) select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a'); count(distinct a1,a2,b) 4 @@ -1924,19 +1924,19 @@ where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a1 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (((`test`.`t1`.`a1` = _latin1'b') or (`test`.`t1`.`a1` = _latin1'd') or (`test`.`t1`.`a1` = _latin1'a') or (`test`.`t1`.`a1` = _latin1'c')) and (`test`.`t1`.`a2` > _latin1'a') and (`test`.`t1`.`c` > _latin1'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2` +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`c` > 'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2` explain extended select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (((`test`.`t1`.`a1` = _latin1'b') or (`test`.`t1`.`a1` = _latin1'd') or (`test`.`t1`.`a1` = _latin1'a') or (`test`.`t1`.`a1` = _latin1'c')) and (`test`.`t1`.`a2` > _latin1'a') and (`test`.`t1`.`d` > _latin1'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`d` > 'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain extended select a1,a2,b,c from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (((`test`.`t1`.`a1` = _latin1'b') or (`test`.`t1`.`a1` = _latin1'd') or (`test`.`t1`.`a1` = _latin1'a') or (`test`.`t1`.`a1` = _latin1'c')) and (`test`.`t1`.`a2` > _latin1'a') and (`test`.`t1`.`d` > _latin1'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c` +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`d` > 'xy2')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c` explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index @@ -1944,7 +1944,7 @@ explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (((`test`.`t1`.`a1` = _latin1'b') or (`test`.`t1`.`a1` = _latin1'd') or (`test`.`t1`.`a1` = _latin1'a') or (`test`.`t1`.`a1` = _latin1'c')) and (`test`.`t1`.`a2` > _latin1'a') and (`test`.`t1`.`c` > _latin1'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (((`test`.`t1`.`a1` = 'b') or (`test`.`t1`.`a1` = 'd') or (`test`.`t1`.`a1` = 'a') or (`test`.`t1`.`a1` = 'c')) and (`test`.`t1`.`a2` > 'a') and (`test`.`t1`.`c` > 'a111')) group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index @@ -1968,12 +1968,12 @@ explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2, id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where (`test`.`t1`.`a1` > _latin1'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` +Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,count(`test`.`t1`.`a2`) AS `count(a2)` from `test`.`t1` where (`test`.`t1`.`a1` > 'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain extended select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 128 75.00 Using where; Using index Warnings: -Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where (`test`.`t1`.`a1` > _latin1'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` +Note 1003 select sum(ord(`test`.`t1`.`a1`)) AS `sum(ord(a1))` from `test`.`t1` where (`test`.`t1`.`a1` > 'a') group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain select distinct(a1) from t1 where ord(a2) = 98; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL idx_t1_2 147 NULL 128 Using where; Using index diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index ddf675e2f73..a2c208ee3e1 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -256,6 +256,7 @@ set @a=repeat(' ',20); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); Warnings: Note 1265 Data truncated for column 'v' at row 1 +Note 1265 Data truncated for column 'c' at row 1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+ *+*+ * diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index ddc0e189cd2..c5c79b15ca6 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -387,15 +387,11 @@ show keys from v4; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment select * from information_schema.views where TABLE_NAME like "v%"; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL test v0 select schema_name from information_schema.schemata NONE NO root@localhost DEFINER latin1 latin1_swedish_ci -NULL test v1 select table_name from information_schema.tables -where table_name="v1" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci -NULL test v2 select column_name from information_schema.columns -where table_name="v2" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci -NULL test v3 select CHARACTER_SET_NAME from information_schema.character_sets -where CHARACTER_SET_NAME like "latin1%" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci -NULL test v4 select COLLATION_NAME from information_schema.collations -where COLLATION_NAME like "latin1%" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v0 select `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v1 select `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = 'v1') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v2 select `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = 'v2') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v3 select `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like 'latin1%') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v4 select `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like 'latin1%') NONE NO root@localhost DEFINER latin1 latin1_swedish_ci drop view v0, v1, v2, v3, v4; create table t1 (a int); grant select,update,insert on t1 to mysqltest_1@localhost; @@ -488,9 +484,9 @@ create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION; create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION; select * from information_schema.views; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL test v1 select a from t1 with check option CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci -NULL test v2 select a from t1 WITH LOCAL CHECK OPTION LOCAL YES root@localhost DEFINER latin1 latin1_swedish_ci -NULL test v3 select a from t1 WITH CASCADED CHECK OPTION CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci grant select (a) on test.t1 to joe@localhost with grant option; select * from INFORMATION_SCHEMA.COLUMN_PRIVILEGES; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE @@ -588,7 +584,7 @@ proc body longblob proc definer char(77) proc created timestamp proc modified timestamp -proc sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') +proc sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') proc comment char(64) proc character_set_client char(32) proc collation_connection char(32) @@ -1175,7 +1171,7 @@ select * from information_schema.views where table_name='v1' or table_name='v2'; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION NULL test v1 NONE YES root@localhost DEFINER latin1 latin1_swedish_ci -NULL test v2 select 1 NONE NO mysqltest_1@localhost DEFINER latin1 latin1_swedish_ci +NULL test v2 select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER latin1 latin1_swedish_ci drop view v1, v2; drop table t1; drop user mysqltest_1@localhost; @@ -1475,11 +1471,22 @@ f6 bigint(20) NO 10 f7 datetime NO NULL f8 datetime YES 2006-01-01 00:00:00 drop table t1; -End of 5.0 tests. show fields from information_schema.table_names; ERROR 42S02: Unknown table 'table_names' in information_schema show keys from information_schema.table_names; ERROR 42S02: Unknown table 'table_names' in information_schema +USE information_schema; +SET max_heap_table_size = 16384; +CREATE TABLE test.t1( a INT ); +SELECT * +FROM tables ta +JOIN collations co ON ( co.collation_name = ta.table_catalog ) +JOIN character_sets cs ON ( cs.character_set_name = ta.table_catalog ); +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN +DROP TABLE test.t1; +SET max_heap_table_size = DEFAULT; +USE test; +End of 5.0 tests. select * from information_schema.engines WHERE ENGINE="MyISAM"; ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS MyISAM DEFAULT Default engine as of MySQL 3.23 with great performance NO NO NO @@ -1556,11 +1563,10 @@ count(*) 0 CREATE VIEW v1 AS SELECT * -FROM INFORMATION_SCHEMA.TABLES; +FROM information_schema.tables; SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS where TABLE_NAME = 'v1'; VIEW_DEFINITION -SELECT * -FROM INFORMATION_SCHEMA.TABLES +select `tables`.`TABLE_CATALOG` AS `TABLE_CATALOG`,`tables`.`TABLE_SCHEMA` AS `TABLE_SCHEMA`,`tables`.`TABLE_NAME` AS `TABLE_NAME`,`tables`.`TABLE_TYPE` AS `TABLE_TYPE`,`tables`.`ENGINE` AS `ENGINE`,`tables`.`VERSION` AS `VERSION`,`tables`.`ROW_FORMAT` AS `ROW_FORMAT`,`tables`.`TABLE_ROWS` AS `TABLE_ROWS`,`tables`.`AVG_ROW_LENGTH` AS `AVG_ROW_LENGTH`,`tables`.`DATA_LENGTH` AS `DATA_LENGTH`,`tables`.`MAX_DATA_LENGTH` AS `MAX_DATA_LENGTH`,`tables`.`INDEX_LENGTH` AS `INDEX_LENGTH`,`tables`.`DATA_FREE` AS `DATA_FREE`,`tables`.`AUTO_INCREMENT` AS `AUTO_INCREMENT`,`tables`.`CREATE_TIME` AS `CREATE_TIME`,`tables`.`UPDATE_TIME` AS `UPDATE_TIME`,`tables`.`CHECK_TIME` AS `CHECK_TIME`,`tables`.`TABLE_COLLATION` AS `TABLE_COLLATION`,`tables`.`CHECKSUM` AS `CHECKSUM`,`tables`.`CREATE_OPTIONS` AS `CREATE_OPTIONS`,`tables`.`TABLE_COMMENT` AS `TABLE_COMMENT` from `information_schema`.`tables` DROP VIEW v1; SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME ='information_schema'; @@ -1623,4 +1629,21 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E show events where Db= 'information_schema'; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation use test; +# +# Bug#34166: Server crash in SHOW OPEN TABLES and prelocking +# +drop table if exists t1; +drop function if exists f1; +create table t1 (a int); +create function f1() returns int +begin +insert into t1 (a) values (1); +return 0; +end| +show open tables where f1()=0; +show open tables where f1()=0; +drop table t1; +drop function f1; +select * from information_schema.tables where 1=sleep(100000); +select * from information_schema.columns where 1=sleep(100000); End of 5.1 tests. diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result index cb56fb3d5cc..eff5f117c50 100644 --- a/mysql-test/r/information_schema_db.result +++ b/mysql-test/r/information_schema_db.result @@ -128,7 +128,7 @@ grant show view on v6 to testdb_2@localhost; create table t2 (f1 char(4)); create definer=`no_such_user`@`no_such_host` view v7 as select * from t2; Warnings: -Note 1449 There is no 'no_such_user'@'no_such_host' registered +Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist show fields from testdb_1.v6; Field Type Null Key Default Extra f1 char(4) YES NULL @@ -144,7 +144,7 @@ show fields from testdb_1.v7; Field Type Null Key Default Extra f1 char(4) YES NULL Warnings: -Note 1449 There is no 'no_such_user'@'no_such_host' registered +Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist create table t3 (f1 char(4), f2 char(4)); create view v3 as select f1,f2 from t3; grant insert(f1), insert(f2) on v3 to testdb_2@localhost; @@ -164,7 +164,7 @@ show fields from testdb_1.v7; Field Type Null Key Default Extra f1 char(4) YES NULL Warnings: -Note 1449 There is no 'no_such_user'@'no_such_host' registered +Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist show create view testdb_1.v7; View Create View character_set_client collation_connection v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` latin1 latin1_swedish_ci @@ -210,7 +210,7 @@ v2 select view_definition from information_schema.views a where a.table_name = 'v2'; view_definition -select f1 from testdb_1.v1 +select `v1`.`f1` AS `f1` from `testdb_1`.`v1` select view_definition from information_schema.views a where a.table_name = 'testdb_1.v1'; view_definition diff --git a/mysql-test/r/information_schema_inno.result b/mysql-test/r/information_schema_inno.result index 2ea2a0bec0b..4f36fd2b8b5 100644 --- a/mysql-test/r/information_schema_inno.result +++ b/mysql-test/r/information_schema_inno.result @@ -78,3 +78,14 @@ NULL NULL db-1 t-2 NULL NULL drop database `db-1`; +create table t1(id int primary key) engine = Innodb; +create table t2(pid int, foreign key (pid) references t1(id)) engine = Innodb; +set foreign_key_checks = 0; +drop table t1; +select UNIQUE_CONSTRAINT_NAME +from information_schema.referential_constraints +where constraint_schema = schema(); +UNIQUE_CONSTRAINT_NAME +NULL +drop table t2; +set foreign_key_checks = 1; diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 0ca4ffc943e..7a5ac683835 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1062,6 +1062,19 @@ select count(*) from t2 /* must be 2 as restored after rollback caused by the er count(*) 2 drop table t1, t2; +drop table if exists t1, t2; +CREATE TABLE t1 (a int, PRIMARY KEY (a)); +CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; +create trigger trg_del_t2 after delete on t2 for each row +insert into t1 values (1); +insert into t1 values (1); +insert into t2 values (1),(2); +delete t2 from t2; +ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +select count(*) from t2 /* must be 2 as restored after rollback caused by the error */; +count(*) +2 +drop table t1, t2; create table t1 (a int, b int) engine=innodb; insert into t1 values(20,null); select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on @@ -1727,10 +1740,10 @@ Variable_name Value Innodb_page_size 16384 show status like "Innodb_rows_deleted"; Variable_name Value -Innodb_rows_deleted 70 +Innodb_rows_deleted 71 show status like "Innodb_rows_inserted"; Variable_name Value -Innodb_rows_inserted 1082 +Innodb_rows_inserted 1084 show status like "Innodb_rows_updated"; Variable_name Value Innodb_rows_updated 885 @@ -1823,6 +1836,7 @@ set @a=repeat(' ',20); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); Warnings: Note 1265 Data truncated for column 'v' at row 1 +Note 1265 Data truncated for column 'c' at row 1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+ *+*+ * @@ -3218,3 +3232,35 @@ a 2 DROP TABLE t1; DROP TABLE t2; +create table t1 (i int, j int) engine=innodb; +insert into t1 (i, j) values (1, 1), (2, 2); +update t1 set j = 2; +affected rows: 1 +info: Rows matched: 2 Changed: 1 Warnings: 0 +drop table t1; +create table t1 (id int) comment='this is a comment' engine=innodb; +select table_comment, data_free > 0 as data_free_is_set +from information_schema.tables +where table_schema='test' and table_name = 't1'; +table_comment data_free_is_set +this is a comment 1 +drop table t1; +CREATE TABLE t1 ( +c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +c2 VARCHAR(128) NOT NULL, +PRIMARY KEY(c1) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=100; +CREATE TABLE t2 ( +c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +c2 INT(10) UNSIGNED DEFAULT NULL, +PRIMARY KEY(c1) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=200; +SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; +AUTO_INCREMENT +200 +ALTER TABLE t2 ADD CONSTRAINT t1_t2_1 FOREIGN KEY(c1) REFERENCES t1(c1); +SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; +AUTO_INCREMENT +200 +DROP TABLE t2; +DROP TABLE t1; diff --git a/mysql-test/r/innodb_bug34053.result b/mysql-test/r/innodb_bug34053.result new file mode 100644 index 00000000000..195775f74c8 --- /dev/null +++ b/mysql-test/r/innodb_bug34053.result @@ -0,0 +1 @@ +SET storage_engine=InnoDB; diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index e9f00a667c0..c7f5e72bb8b 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -1356,6 +1356,12 @@ id type d NULL member 3 NULL member 4 DROP TABLE t1; +set @my_innodb_autoextend_increment=@@global.innodb_autoextend_increment; +set global innodb_autoextend_increment=8; +set global innodb_autoextend_increment=@my_innodb_autoextend_increment; +set @my_innodb_commit_concurrency=@@global.innodb_commit_concurrency; +set global innodb_commit_concurrency=0; +set global innodb_commit_concurrency=@my_innodb_commit_concurrency; End of 5.0 tests CREATE TABLE `t2` ( `k` int(11) NOT NULL auto_increment, @@ -1634,4 +1640,17 @@ vid tid idx name type 3 1 2 c1 NULL 3 1 1 pk NULL DROP TABLE t1; +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +CREATE TABLE t1(id INT PRIMARY KEY) +ENGINE=innodb; +CREATE TABLE t2( +t1_id INT PRIMARY KEY, +CONSTRAINT fk1 FOREIGN KEY (t1_id) REFERENCES t1(id)) +ENGINE=innodb; + +ALTER TABLE t1 CHANGE id id2 INT; + +DROP TABLE t2; +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result index 3ea5bbd20bc..8b6830d4798 100644 --- a/mysql-test/r/kill.result +++ b/mysql-test/r/kill.result @@ -1,3 +1,5 @@ +set @old_concurrent_insert= @@global.concurrent_insert; +set @@global.concurrent_insert= 0; drop table if exists t1, t2, t3; create table t1 (kill_id int); insert into t1 values(connection_id()); @@ -136,3 +138,4 @@ KILL CONNECTION_ID(); # of close of the connection socket SELECT 1; Got one of the listed errors +set @@global.concurrent_insert= @old_concurrent_insert; diff --git a/mysql-test/r/limit.result b/mysql-test/r/limit.result index 01d7d7ca218..2acf74162a4 100644 --- a/mysql-test/r/limit.result +++ b/mysql-test/r/limit.result @@ -94,6 +94,9 @@ drop table t1; prepare s from "select 1 limit ?"; set @a='qwe'; execute s using @a; +1 +set @a=-1; +execute s using @a; ERROR HY000: Incorrect arguments to EXECUTE prepare s from "select 1 limit 1, ?"; execute s using @a; @@ -101,4 +104,10 @@ ERROR HY000: Incorrect arguments to EXECUTE prepare s from "select 1 limit ?, ?"; execute s using @a, @a; ERROR HY000: Incorrect arguments to EXECUTE +set @a=14632475938453979136; +execute s using @a, @a; +1 +set @a=-14632475938453979136; +execute s using @a, @a; +ERROR HY000: Incorrect arguments to EXECUTE End of 5.0 tests diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 98e221b0dea..3a23d9de6b3 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -261,6 +261,82 @@ SELECT * FROM t1; c1 c2 c3 c4 10 1970-02-01 01:02:03 1.1e-100 1.1e+100 DROP TABLE t1; + +# -- +# -- Bug#35469: server crash with LOAD DATA INFILE to a VIEW. +# -- + +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP VIEW IF EXISTS v2; +DROP VIEW IF EXISTS v3; + +CREATE TABLE t1(c1 INT, c2 VARCHAR(255)); + +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE VIEW v2 AS SELECT 1 + 2 AS c0, c1, c2 FROM t1; +CREATE VIEW v3 AS SELECT 1 AS d1, 2 AS d2; + +LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v1 +FIELDS ESCAPED BY '\\' + TERMINATED BY ',' + ENCLOSED BY '"' + LINES TERMINATED BY '\n' (c1, c2); + +SELECT * FROM t1; +c1 c2 +1 "string1" +2 "string2" +3 "string3" + +SELECT * FROM v1; +c1 c2 +1 "string1" +2 "string2" +3 "string3" + +DELETE FROM t1; + +LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2 +FIELDS ESCAPED BY '\\' + TERMINATED BY ',' + ENCLOSED BY '"' + LINES TERMINATED BY '\n' (c1, c2); + +SELECT * FROM t1; +c1 c2 +1 "string1" +2 "string2" +3 "string3" + +SELECT * FROM v2; +c0 c1 c2 +3 1 "string1" +3 2 "string2" +3 3 "string3" + +DELETE FROM t1; + +LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2 +FIELDS ESCAPED BY '\\' + TERMINATED BY ',' + ENCLOSED BY '"' + LINES TERMINATED BY '\n' (c0, c2); +ERROR HY000: Invalid column reference (v2.c0) in LOAD DATA + +LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v3 +FIELDS ESCAPED BY '\\' + TERMINATED BY ',' + ENCLOSED BY '"' + LINES TERMINATED BY '\n' (d1, d2); +ERROR HY000: The target table v3 of the LOAD is not updatable + +DROP TABLE t1; +DROP VIEW v1; +DROP VIEW v2; +DROP VIEW v3; + +# -- End of Bug#35469. CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (1); SET NAMES latin1; diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result index 9c4f1b17dcc..cd05fc1473f 100644 --- a/mysql-test/r/lock_multi.result +++ b/mysql-test/r/lock_multi.result @@ -143,4 +143,14 @@ connection: default flush tables; unlock tables; drop table t1; +drop table if exists t1,t2; +create table t1 (a int); +flush status; +lock tables t1 read; +insert into t1 values(1);; +unlock tables; +drop table t1; +select @tlwa < @tlwb; +@tlwa < @tlwb +1 End of 5.1 tests diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index 0a7634df85a..2a4cee9fbbc 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -107,6 +107,17 @@ Database Table In_use Name_locked SET GLOBAL GENERAL_LOG=ON; SET GLOBAL SLOW_QUERY_LOG=ON; truncate table mysql.general_log; +set names binary; +select _koi8r'ÔÅÓÔ' as test; +test +ÔÅÓÔ +select * from mysql.general_log; +event_time user_host thread_id server_id command_type argument +TIMESTAMP USER_HOST THREAD_ID 1 Query set names binary +TIMESTAMP USER_HOST THREAD_ID 1 Query select _koi8r'\xD4\xC5\xD3\xD4' as test +TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log +set names utf8; +truncate table mysql.general_log; set names utf8; create table bug16905 (s char(15) character set utf8 default 'пуÑто'); insert into bug16905 values ('новое'); diff --git a/mysql-test/r/merge-big.result b/mysql-test/r/merge-big.result index 82fedc1df73..e34ebbd9578 100644 --- a/mysql-test/r/merge-big.result +++ b/mysql-test/r/merge-big.result @@ -24,54 +24,3 @@ UNLOCK TABLES; SET SESSION debug="-d,sleep_open_and_lock_after_open"; # connection default DROP TABLE t1; -# -# Extra tests for Bug#26379 - Combination of FLUSH TABLE and -# REPAIR TABLE corrupts a MERGE table -# -CREATE TABLE t1 (c1 INT); -CREATE TABLE t2 (c1 INT); -CREATE TABLE t3 (c1 INT); -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (2); -INSERT INTO t3 VALUES (3); -# -# CREATE ... SELECT -# try to access parent from another thread. -# -# connection con1 -SET SESSION debug="+d,sleep_create_select_before_lock"; -CREATE TABLE t4 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2) -INSERT_METHOD=FIRST SELECT * FROM t3; -# connection default -# Now try to access the parent. -# If 3 is in table, SELECT had to wait. -SELECT * FROM t4 ORDER BY c1; -c1 -1 -2 -3 -# connection con1 -SET SESSION debug="-d,sleep_create_select_before_lock"; -# connection default -# Cleanup for next test. -DROP TABLE t4; -DELETE FROM t1 WHERE c1 != 1; -# -# CREATE ... SELECT -# try to access child from another thread. -# -# connection con1 -SET SESSION debug="+d,sleep_create_select_before_lock"; -CREATE TABLE t4 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1,t2) -INSERT_METHOD=FIRST SELECT * FROM t3; -# connection default -# Now try to access a child. -# If 3 is in table, SELECT had to wait. -SELECT * FROM t1 ORDER BY c1; -c1 -1 -3 -# connection con1 -SET SESSION debug="-d,sleep_create_select_before_lock"; -# connection default -DROP TABLE t1, t2, t3, t4; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index c1bd0670e0e..dad2e23d594 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -966,6 +966,28 @@ id ref 3 2 4 5 DROP TABLE t1, t2, t3; +CREATE TABLE t1(a INT); +CREATE TABLE m1(a INT) ENGINE=MERGE; +SHOW CREATE TABLE m1; +Table Create Table +m1 CREATE TABLE `m1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 +DROP TABLE m1; +CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(); +SHOW CREATE TABLE m1; +Table Create Table +m1 CREATE TABLE `m1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 +ALTER TABLE m1 UNION=(t1); +ALTER TABLE m1 UNION=(); +SHOW CREATE TABLE m1; +Table Create Table +m1 CREATE TABLE `m1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, m1; End of 5.0 tests create table t1 (c1 int, index(c1)); create table t2 (c1 int, index(c1)) engine=merge union=(t1); @@ -1131,7 +1153,7 @@ SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `c1` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=() +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT INTO t4 VALUES (4); ERROR HY000: Table 't4' is read only DROP TABLE t4; @@ -1148,7 +1170,7 @@ SHOW CREATE TABLE t4; Table Create Table t4 CREATE TABLE `t4` ( `c1` int(11) DEFAULT NULL -) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=() +) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT INTO t4 VALUES (4); ERROR HY000: Table 't4' is read only DROP TABLE t4; diff --git a/mysql-test/r/mix2_myisam.result b/mysql-test/r/mix2_myisam.result index e0a3d1af089..a716818722b 100644 --- a/mysql-test/r/mix2_myisam.result +++ b/mysql-test/r/mix2_myisam.result @@ -1415,6 +1415,7 @@ set @a=repeat(' ',20); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); Warnings: Note 1265 Data truncated for column 'v' at row 1 +Note 1265 Data truncated for column 'c' at row 1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+ *+*+ * diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index d96927deed5..421a63cd54c 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -627,7 +627,7 @@ a b 4 4 show master status /* there must be the UPDATE query event */; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 336 +master-bin.000001 197 delete from t1; delete from t2; insert into t1 values (1,2),(3,4),(4,4); @@ -637,7 +637,7 @@ UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a; ERROR 23000: Duplicate entry '4' for key 'PRIMARY' show master status /* there must be the UPDATE query event */; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 351 +master-bin.000001 212 drop table t1, t2; set @@session.binlog_format= @sav_binlog_format; drop table if exists t1, t2, t3; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 4fbe134156f..c527da56a53 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1086,6 +1086,7 @@ set @a=repeat(' ',20); insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); Warnings: Note 1265 Data truncated for column 'v' at row 1 +Note 1265 Data truncated for column 'c' at row 1 select concat('*',v,'*',c,'*',t,'*') from t1; concat('*',v,'*',c,'*',t,'*') *+ *+*+ * @@ -2023,6 +2024,187 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; +CREATE TABLE t1 ( +c1 CHAR(130), +c2 VARCHAR(1) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES(REPEAT("a",128), 'b'); +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CREATE TABLE t1 ( +c1 CHAR(130), +c2 VARCHAR(1) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES(REPEAT("a",128), 'b'); +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CREATE TABLE t1 ( +c1 CHAR(130), +c2 VARCHAR(1) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES(REPEAT("a",128), 'b'); +INSERT INTO t1 VALUES('b', 'b'); +INSERT INTO t1 VALUES('c', 'b'); +DELETE FROM t1 WHERE c1='b'; +SELECT COUNT(*) FROM t1; +COUNT(*) +2 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SELECT COUNT(*) FROM t1; +COUNT(*) +2 +DROP TABLE t1; +CREATE TABLE t1 ( +c1 CHAR(130), +c2 VARCHAR(1), +KEY (c1) +) ENGINE=MyISAM; +# Insert 100 rows. Query log disabled. +UPDATE t1 SET c1=REPEAT("a",128) LIMIT 90; +SELECT COUNT(*) FROM t1; +COUNT(*) +100 +ALTER TABLE t1 ENGINE=MyISAM; +SELECT COUNT(*) FROM t1; +COUNT(*) +100 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CREATE TABLE t1 ( +c1 CHAR(50), +c2 VARCHAR(1) +) ENGINE=MyISAM DEFAULT CHARSET UTF8; +INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b'); +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CREATE TABLE t1 ( +c1 CHAR(50), +c2 VARCHAR(1) +) ENGINE=MyISAM DEFAULT CHARSET UTF8; +INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b'); +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CREATE TABLE t1 ( +c1 CHAR(50), +c2 VARCHAR(1) +) ENGINE=MyISAM DEFAULT CHARSET UTF8; +INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b'); +INSERT INTO t1 VALUES('b', 'b'); +INSERT INTO t1 VALUES('c', 'b'); +DELETE FROM t1 WHERE c1='b'; +SELECT COUNT(*) FROM t1; +COUNT(*) +2 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +SELECT COUNT(*) FROM t1; +COUNT(*) +2 +DROP TABLE t1; +CREATE TABLE t1 ( +c1 CHAR(50), +c2 VARCHAR(1), +KEY (c1) +) ENGINE=MyISAM DEFAULT CHARSET UTF8; +# Insert 100 rows. Query log disabled. +UPDATE t1 SET c1=REPEAT(_utf8 x'e0ae85',43) LIMIT 90; +SELECT COUNT(*) FROM t1; +COUNT(*) +100 +ALTER TABLE t1 ENGINE=MyISAM; +SELECT COUNT(*) FROM t1; +COUNT(*) +100 +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CREATE TABLE t1 ( +c1 VARCHAR(10) NOT NULL, +c2 CHAR(10) DEFAULT NULL, +c3 VARCHAR(10) NOT NULL, +KEY (c1), +KEY (c2) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0; + +MyISAM file: MYSQLTEST_VARDIR/master-data/test/t1 +Record format: Packed +Character set: utf8_general_ci (33) +Data records: 0 Deleted blocks: 0 +Recordlength: 94 + +table description: +Key Start Len Index Type +1 2 30 multip. varchar +2 33 30 multip. char NULL +DROP TABLE t1; create table t1 (n int not null, c char(1)) transactional=1; Warnings: Error 1478 Table storage engine 'MyISAM' does not support the create option 'TRANSACTIONAL=1' diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 4ffcb7cdeeb..7c5fdf5f3d0 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -19,10 +19,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; drop table if exists t1,t2,t3,t4,t5,t03,t04 /*!*/; SET TIMESTAMP=1000000000/*!*/; @@ -61,10 +65,14 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values ("Alas") /*!*/; DELIMITER ; @@ -89,10 +97,14 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values ("Alas") /*!*/; DELIMITER ; @@ -107,10 +119,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; drop table if exists t1,t2,t3,t4,t5,t03,t04 /*!*/; SET TIMESTAMP=1000000000/*!*/; @@ -149,10 +165,14 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values ("Alas") /*!*/; DELIMITER ; @@ -177,10 +197,14 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values ("Alas") /*!*/; DELIMITER ; @@ -195,6 +219,10 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1108844556/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; BEGIN /*!*/; SET TIMESTAMP=1108844555/*!*/; @@ -209,6 +237,10 @@ ROLLBACK /* added by mysqlbinlog */; DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1108844556/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; BEGIN /*!*/; SET TIMESTAMP=1108844555/*!*/; @@ -265,10 +297,14 @@ ERROR 42000: PROCEDURE test.p1 does not exist DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; CREATE DEFINER=`root`@`localhost` procedure p1() begin select 1; @@ -311,10 +347,14 @@ flush logs; DELIMITER /*!*/; use test/*!*/; SET TIMESTAMP=1000000000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a varchar(64) character set utf8) /*!*/; SET TIMESTAMP=1000000000/*!*/; diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result index 0c9ba34fc61..89fc4b87d29 100644 --- a/mysql-test/r/mysqlbinlog2.result +++ b/mysql-test/r/mysqlbinlog2.result @@ -18,61 +18,39 @@ insert into t1 values(null, "f"); /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Start: binlog v #, server v ## created {yymmdd} {HH:MM:SS} at startup ROLLBACK/*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0 use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar SET INSERT_ID=1/*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0 SET TIMESTAMP=1579609942/*!*/; insert into t1 values(null, "a") /*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar SET INSERT_ID=2/*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0 SET TIMESTAMP=1579609942/*!*/; insert into t1 values(null, "b") /*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar SET INSERT_ID=3/*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0 SET TIMESTAMP=1579609944/*!*/; insert into t1 values(null, "c") /*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar SET INSERT_ID=4/*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0 SET TIMESTAMP=1579609946/*!*/; insert into t1 values(null, "d") /*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Intvar SET INSERT_ID=5/*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Query thread_id={integer} exec_time={integer} error_code=0 SET TIMESTAMP=1579609946/*!*/; insert into t1 values(null, "e") /*!*/; -# at {pos} -#{yymmdd} {HH:MM:SS} server id 1 end_log_pos {pos} Rotate to master-bin.000002 pos: {pos} DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; @@ -86,10 +64,14 @@ ROLLBACK/*!*/; SET INSERT_ID=1/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "a") /*!*/; SET INSERT_ID=2/*!*/; @@ -121,10 +103,14 @@ ROLLBACK/*!*/; SET INSERT_ID=4/*!*/; use test/*!*/; SET TIMESTAMP=1579609946/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "d") /*!*/; SET INSERT_ID=5/*!*/; @@ -143,10 +129,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; SET INSERT_ID=1/*!*/; @@ -174,10 +164,14 @@ ROLLBACK/*!*/; SET INSERT_ID=4/*!*/; use test/*!*/; SET TIMESTAMP=1579609946/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "d") /*!*/; DELIMITER ; @@ -193,10 +187,14 @@ ROLLBACK/*!*/; SET INSERT_ID=3/*!*/; use test/*!*/; SET TIMESTAMP=1579609944/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "c") /*!*/; SET INSERT_ID=4/*!*/; @@ -219,10 +217,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; SET INSERT_ID=1/*!*/; @@ -246,10 +248,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; SET INSERT_ID=1/*!*/; @@ -277,10 +283,14 @@ DELIMITER /*!*/; SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "f") /*!*/; DELIMITER ; @@ -296,10 +306,14 @@ ROLLBACK/*!*/; SET INSERT_ID=1/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "a") /*!*/; SET INSERT_ID=2/*!*/; @@ -323,10 +337,14 @@ DELIMITER /*!*/; SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "f") /*!*/; DELIMITER ; @@ -342,10 +360,14 @@ ROLLBACK/*!*/; SET INSERT_ID=4/*!*/; use test/*!*/; SET TIMESTAMP=1579609946/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "d") /*!*/; SET INSERT_ID=5/*!*/; @@ -357,10 +379,14 @@ DELIMITER /*!*/; SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "f") /*!*/; DELIMITER ; @@ -375,10 +401,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; SET INSERT_ID=1/*!*/; @@ -417,10 +447,14 @@ ROLLBACK/*!*/; SET INSERT_ID=3/*!*/; use test/*!*/; SET TIMESTAMP=1579609944/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "c") /*!*/; SET INSERT_ID=4/*!*/; @@ -436,10 +470,14 @@ DELIMITER /*!*/; SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "f") /*!*/; DELIMITER ; @@ -454,10 +492,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; SET INSERT_ID=1/*!*/; @@ -480,10 +522,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; SET INSERT_ID=1/*!*/; @@ -519,10 +565,14 @@ ROLLBACK/*!*/; SET INSERT_ID=1/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "a") /*!*/; SET INSERT_ID=2/*!*/; @@ -553,10 +603,14 @@ DELIMITER /*!*/; SET INSERT_ID=4/*!*/; use test/*!*/; SET TIMESTAMP=1579609946/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "d") /*!*/; SET INSERT_ID=5/*!*/; @@ -575,10 +629,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; SET INSERT_ID=1/*!*/; @@ -605,10 +663,14 @@ DELIMITER /*!*/; SET INSERT_ID=4/*!*/; use test/*!*/; SET TIMESTAMP=1579609946/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "d") /*!*/; DELIMITER ; @@ -624,10 +686,14 @@ ROLLBACK/*!*/; SET INSERT_ID=3/*!*/; use test/*!*/; SET TIMESTAMP=1579609944/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "c") /*!*/; SET INSERT_ID=4/*!*/; @@ -650,10 +716,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; SET INSERT_ID=1/*!*/; @@ -676,10 +746,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; SET INSERT_ID=1/*!*/; @@ -707,10 +781,14 @@ DELIMITER /*!*/; SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "f") /*!*/; DELIMITER ; @@ -726,10 +804,14 @@ ROLLBACK/*!*/; SET INSERT_ID=1/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "a") /*!*/; SET INSERT_ID=2/*!*/; @@ -753,10 +835,14 @@ DELIMITER /*!*/; SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "f") /*!*/; DELIMITER ; @@ -771,10 +857,14 @@ DELIMITER /*!*/; SET INSERT_ID=4/*!*/; use test/*!*/; SET TIMESTAMP=1579609946/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "d") /*!*/; SET INSERT_ID=5/*!*/; @@ -786,10 +876,14 @@ DELIMITER /*!*/; SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "f") /*!*/; DELIMITER ; @@ -804,10 +898,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; SET INSERT_ID=1/*!*/; @@ -846,10 +944,14 @@ ROLLBACK/*!*/; SET INSERT_ID=3/*!*/; use test/*!*/; SET TIMESTAMP=1579609944/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "c") /*!*/; SET INSERT_ID=4/*!*/; @@ -865,10 +967,14 @@ DELIMITER /*!*/; SET INSERT_ID=6/*!*/; use test/*!*/; SET TIMESTAMP=1579609943/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t1 values(null, "f") /*!*/; DELIMITER ; @@ -883,10 +989,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; SET INSERT_ID=1/*!*/; @@ -909,10 +1019,14 @@ DELIMITER /*!*/; ROLLBACK/*!*/; use test/*!*/; SET TIMESTAMP=1579609942/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int auto_increment not null primary key, b char(3)) /*!*/; SET INSERT_ID=1/*!*/; diff --git a/mysql-test/r/mysqldump-no-binlog.result b/mysql-test/r/mysqldump-no-binlog.result new file mode 100644 index 00000000000..78bc19b7cba --- /dev/null +++ b/mysql-test/r/mysqldump-no-binlog.result @@ -0,0 +1 @@ +mysqldump: Error: Binlogging on server not active diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 6d0e1aaab29..65e8505c799 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -2011,7 +2011,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */ +/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like 'a%') */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -2182,7 +2182,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */ +/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like 'a%') */ /*!50002 WITH CASCADED CHECK OPTION */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -3870,181 +3870,6 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; -create table t1 (a text , b text); -create table t2 (a text , b text); -insert t1 values ("Duck, Duck", "goose"); -insert t1 values ("Duck, Duck", "pidgeon"); -insert t2 values ("We the people", "in order to perform"); -insert t2 values ("a more perfect", "union"); -select * from t1; -a b -Duck, Duck goose -Duck, Duck pidgeon -select * from t2; -a b -We the people in order to perform -a more perfect union -test.t1: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 -test.t2: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 -select * from t1; -a b -Duck, Duck goose -Duck, Duck pidgeon -Duck, Duck goose -Duck, Duck pidgeon -select * from t2; -a b -We the people in order to perform -a more perfect union -We the people in order to perform -a more perfect union -create table words(a varchar(255)); -create table words2(b varchar(255)); -select * from t1; -a b -Duck, Duck goose -Duck, Duck pidgeon -Duck, Duck goose -Duck, Duck pidgeon -Duck, Duck goose -Duck, Duck pidgeon -select * from t2; -a b -We the people in order to perform -a more perfect union -We the people in order to perform -a more perfect union -We the people in order to perform -a more perfect union -select * from words; -a -Aarhus -Aaron -Ababa -aback -abaft -abandon -abandoned -abandoning -abandonment -abandons -Aarhus -Aaron -Ababa -aback -abaft -abandon -abandoned -abandoning -abandonment -abandons -abase -abased -abasement -abasements -abases -abash -abashed -abashes -abashing -abasing -abate -abated -abatement -abatements -abater -abates -abating -Abba -abbe -abbey -abbeys -abbot -abbots -Abbott -abbreviate -abbreviated -abbreviates -abbreviating -abbreviation -abbreviations -Abby -abdomen -abdomens -abdominal -abduct -abducted -abduction -abductions -abductor -abductors -abducts -Abe -abed -Abel -Abelian -Abelson -Aberdeen -Abernathy -aberrant -aberration -select * from words2; -b -abase -abased -abasement -abasements -abases -abash -abashed -abashes -abashing -abasing -abate -abated -abatement -abatements -abater -abates -abating -Abba -abbe -abbey -abbeys -abbot -abbots -Abbott -abbreviate -abbreviated -abbreviates -abbreviating -abbreviation -abbreviations -Abby -abdomen -abdomens -abdominal -abduct -abducted -abduction -abductions -abductor -abductors -abducts -Abe -abed -Abel -Abelian -Abelson -Aberdeen -Abernathy -aberrant -aberration -drop table words; -mysql-import: Error: 1146, Table 'test.words' doesn't exist, when using table: words -drop table t1; -drop table t2; -drop table words2; # # BUG# 16853: mysqldump doesn't show events # @@ -4230,6 +4055,40 @@ LOCK TABLES `test` WRITE; UNLOCK TABLES; drop database `test-database`; use test; + +# ----------------------------------------------------------------- +# -- Bug#30217: Views: changes in metadata behaviour between 5.0 and 5.1. +# ----------------------------------------------------------------- + +DROP DATABASE IF EXISTS mysqldump_test_db; +CREATE DATABASE mysqldump_test_db; +use mysqldump_test_db; + +CREATE VIEW v1(x, y) AS SELECT 'a', 'a'; + +SELECT view_definition +FROM INFORMATION_SCHEMA.VIEWS +WHERE table_schema = 'mysqldump_test_db' AND table_name = 'v1'; +view_definition +select 'a' AS `x`,'a' AS `y` + +---> Dumping mysqldump_test_db to bug30217.sql + +DROP DATABASE mysqldump_test_db; +use test; + +---> Restoring mysqldump_test_db... + +SELECT view_definition +FROM INFORMATION_SCHEMA.VIEWS +WHERE table_schema = 'mysqldump_test_db' AND table_name = 'v1'; +view_definition +select 'a' AS `x`,'a' AS `y` + +DROP DATABASE mysqldump_test_db; + +# -- End of test case for Bug#32538. + # # End of 5.1 tests # diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index a7df1a523cf..48eb0bf5cc0 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -293,7 +293,7 @@ var5 from query that returns no row failing query in let mysqltest: At line 1: Error running query 'failing query': 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing query' at line 1 mysqltest: At line 1: Missing required argument 'filename' to command 'source' -mysqltest: At line 1: Could not open file './non_existingFile' +mysqltest: At line 1: Could not open './non_existingFile' for reading mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 @@ -443,7 +443,7 @@ ERROR 3D000: No database selected Output from mysqltest-x.inc Output from mysqltest-x.inc Output from mysqltest-x.inc -mysqltest: Could not open ./non_existing_file.inc: errno = 2 +mysqltest: Could not open './non_existing_file.inc' for reading: errno = 2 failing_statement; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1 failing_statement; diff --git a/mysql-test/r/named_pipe.result b/mysql-test/r/named_pipe.result index eb93c5f6344..32e96fa27b7 100644 --- a/mysql-test/r/named_pipe.result +++ b/mysql-test/r/named_pipe.result @@ -1505,7 +1505,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1'')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 diff --git a/mysql-test/r/negation_elimination.result b/mysql-test/r/negation_elimination.result index ccb8e87b714..91a4c273832 100644 --- a/mysql-test/r/negation_elimination.result +++ b/mysql-test/r/negation_elimination.result @@ -387,5 +387,5 @@ explain extended select a, not(not(a)), not(a <= 2 and not(a)), not(a not like " id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL a 5 NULL 5 100.00 Using where; Using index Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a` <> 0) AS `not(not(a))`,((`test`.`t1`.`a` > 2) or `test`.`t1`.`a`) AS `not(a <= 2 and not(a))`,(`test`.`t1`.`a` like _latin1'1') AS `not(a not like "1")`,(`test`.`t1`.`a` in (1,2)) AS `not (a not in (1,2))`,(`test`.`t1`.`a` = 2) AS `not(a != 2)` from `test`.`t1` where `test`.`t1`.`a` having `test`.`t1`.`a` +Note 1003 select `test`.`t1`.`a` AS `a`,(`test`.`t1`.`a` <> 0) AS `not(not(a))`,((`test`.`t1`.`a` > 2) or `test`.`t1`.`a`) AS `not(a <= 2 and not(a))`,(`test`.`t1`.`a` like '1') AS `not(a not like "1")`,(`test`.`t1`.`a` in (1,2)) AS `not (a not in (1,2))`,(`test`.`t1`.`a` = 2) AS `not(a != 2)` from `test`.`t1` where `test`.`t1`.`a` having `test`.`t1`.`a` drop table t1; diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result index f2ffe28895d..1b734136e6c 100644 --- a/mysql-test/r/not_embedded_server.result +++ b/mysql-test/r/not_embedded_server.result @@ -3,3 +3,10 @@ execute stmt1; ID USER HOST DB COMMAND TIME STATE INFO number root localhost test Query time executing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!='Daemon' deallocate prepare stmt1; +FLUSH STATUS; +SHOW GLOBAL STATUS LIKE 'com_select'; +Variable_name Value +Com_select 102 +SHOW GLOBAL STATUS LIKE 'com_select'; +Variable_name Value +Com_select 102 diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index 5a2ebc37cc8..64b8aa74af3 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -6,7 +6,7 @@ explain extended select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnu 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 NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,_latin1'TRUE') AS `ifnull(null,"TRUE")`,ifnull(_latin1'TRUE',_latin1'ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null` +Note 1003 select NULL AS `NULL`,NULL AS `NULL`,isnull(NULL) AS `isnull(null)`,isnull((1 / 0)) AS `isnull(1/0)`,isnull(((1 / 0) = NULL)) AS `isnull(1/0 = null)`,ifnull(NULL,1) AS `ifnull(null,1)`,ifnull(NULL,'TRUE') AS `ifnull(null,"TRUE")`,ifnull('TRUE','ERROR') AS `ifnull("TRUE","ERROR")`,isnull((1 / 0)) AS `1/0 is null`,(1 is not null) AS `1 is not null` select 1 | NULL,1 & NULL,1+NULL,1-NULL; 1 | NULL 1 & NULL 1+NULL 1-NULL NULL NULL NULL NULL @@ -49,7 +49,7 @@ explain extended select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),ine 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 inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton(_latin1'122.256') AS `inet_aton("122.256")`,inet_aton(_latin1'122.226.') AS `inet_aton("122.226.")`,inet_aton(_latin1'') AS `inet_aton("")` +Note 1003 select inet_ntoa(NULL) AS `inet_ntoa(null)`,inet_aton(NULL) AS `inet_aton(null)`,inet_aton('122.256') AS `inet_aton("122.256")`,inet_aton('122.226.') AS `inet_aton("122.226.")`,inet_aton('') AS `inet_aton("")` create table t1 (x int); insert into t1 values (null); select * from t1 where x != 0; diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 8a440284c53..58c587fe588 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -429,3 +429,21 @@ Handler_read_prev 0 Handler_read_rnd 0 Handler_read_rnd_next 5 DROP TABLE t1,t2,t3,t4; +CREATE TABLE t1 ( +a int(11) default NULL, +b int(11) default NULL, +KEY a (a,b) +); +INSERT INTO t1 VALUES (0,10),(0,11),(0,12); +CREATE TABLE t2 ( +a int(11) default NULL, +b int(11) default NULL, +KEY a (a) +); +INSERT INTO t2 VALUES (3,NULL),(3,11),(3,12); +SELECT * FROM t2 inner join t1 WHERE ( t1.a = 0 OR t1.a IS NULL) AND t2.a = 3 AND t2.b = t1.b; +a b a b +3 11 0 11 +3 12 0 12 +drop table t1, t2; +End of 5.0 tests diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 3d0f4915d0a..faab8e49880 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -1416,3 +1416,45 @@ SELECT @tmp_tables_after = @tmp_tables_before; @tmp_tables_after = @tmp_tables_before 1 DROP TABLE t1; +# +# Bug#31590: Wrong error message on sort buffer being too small. +# +create table t1(a int, b tinytext); +insert into t1 values (1,2),(3,2); +set session sort_buffer_size= 30000; +Warnings: +Warning 1292 Truncated incorrect sort_buffer_size value: '30000' +set session max_sort_length= 2180; +select * from t1 order by b; +ERROR HY001: Out of sort memory; increase server sort buffer size +drop table t1; +CREATE TABLE t2 (a varchar(32), b int(11), c float, d double, +UNIQUE KEY a (a,b,c), KEY b (b), KEY c (c)); +CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b)); +CREATE TABLE t3 (a varchar(32), b char(3), UNIQUE KEY a (a,b)); +INSERT INTO t3 SELECT * FROM t1; +EXPLAIN +SELECT d FROM t1, t2 +WHERE t2.b=14 AND t2.a=t1.a AND 5.1 1"; +execute stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where (`t1`.`a` > 1) latin1 latin1_swedish_ci +select * from v1; +x +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `x` from `t1` where (`t1`.`a` > 1) latin1 latin1_swedish_ci +select * from v1; +x +drop view v1; +prepare stmt from "create view v1 as select * from `t1` `b`"; +execute stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `b`.`a` AS `a`,`b`.`b` AS `b` from `t1` `b` latin1 latin1_swedish_ci +select * from v1; +a b +drop view v1; +execute stmt; +deallocate prepare stmt; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `b`.`a` AS `a`,`b`.`b` AS `b` from `t1` `b` latin1 latin1_swedish_ci +select * from v1; +a b +drop view v1; +prepare stmt from "create view v1 (a,b,c) as select * from t1"; +execute stmt; +ERROR HY000: View's SELECT and view's field list have different column counts +execute stmt; +ERROR HY000: View's SELECT and view's field list have different column counts +deallocate prepare stmt; +drop table t1; +create temporary table t1 (a int, b int); +prepare stmt from "create view v1 as select * from t1"; +execute stmt; +ERROR HY000: View's SELECT refers to a temporary table 't1' +execute stmt; +ERROR HY000: View's SELECT refers to a temporary table 't1' +deallocate prepare stmt; +drop table t1; +prepare stmt from "create view v1 as select * from t1"; +ERROR 42S02: Table 'test.t1' doesn't exist +prepare stmt from "create view v1 as select * from `t1` `b`"; +ERROR 42S02: Table 'test.t1' doesn't exist +prepare stmt from "select ?"; +set @arg= 123456789.987654321; +select @arg; +@arg +123456789.987654321 +execute stmt using @arg; +? +123456789.987654321 +set @arg= "string"; +select @arg; +@arg +string +execute stmt using @arg; +? +string +set @arg= 123456; +select @arg; +@arg +123456 +execute stmt using @arg; +? +123456 +set @arg= cast(-12345.54321 as decimal(20, 10)); +select @arg; +@arg +-12345.5432100000 +execute stmt using @arg; +? +-12345.5432100000 +deallocate prepare stmt; End of 5.0 tests. create procedure proc_1() reset query cache; call proc_1(); diff --git a/mysql-test/r/ps_ddl.result b/mysql-test/r/ps_ddl.result index 0987e765265..531d29d219e 100644 --- a/mysql-test/r/ps_ddl.result +++ b/mysql-test/r/ps_ddl.result @@ -1,10 +1,11 @@ +SELECT VARIABLE_VALUE from +INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' +into @base_count ; +set @expected = 0; ===================================================================== Testing 1: NOTHING -> TABLE transitions ===================================================================== drop table if exists t1; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; prepare stmt from 'select * from t1'; ERROR 42S02: Table 'test.t1' doesn't exist ===================================================================== @@ -17,92 +18,144 @@ Testing 3: NOTHING -> VIEW transitions Testing 4: TABLE -> NOTHING transitions ===================================================================== drop table if exists t4; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t4(a int); prepare stmt from 'select * from t4'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t4; execute stmt; ERROR 42S02: Table 'test.t4' doesn't exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; ERROR 42S02: Table 'test.t4' doesn't exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 ===================================================================== Testing 5: TABLE -> TABLE (DDL) transitions ===================================================================== drop table if exists t5; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t5(a int); -prepare stmt from 'select * from t5'; +prepare stmt from 'select a from t5'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t5 add column (b int); +set @expected = @expected + 1; execute stmt; -a b -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +a +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; -a b -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +a +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t5; ===================================================================== Testing 6: TABLE -> TABLE (TRIGGER) transitions ===================================================================== drop table if exists t6; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t6(a int); prepare stmt from 'insert into t6(a) value (?)'; set @val=1; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=2; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 create trigger t6_bi before insert on t6 for each row begin set @message= "t6_bi"; @@ -110,20 +163,33 @@ end $$ set @message="none"; set @val=3; +set @expected = @expected + 1; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi set @val=4; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi @@ -131,20 +197,32 @@ prepare stmt from 'insert into t6(a) value (?)'; set @message="none"; set @val=5; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi set @message="none"; set @val=6; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi @@ -155,21 +233,34 @@ end $$ set @message="none"; set @val=7; +set @expected = @expected + 1; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi set @message="none"; set @val=8; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi @@ -177,20 +268,32 @@ prepare stmt from 'insert into t6(a) value (?)'; set @message="none"; set @val=9; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi set @message="none"; set @val=10; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi @@ -202,20 +305,33 @@ end $$ set @message="none"; set @val=11; +set @expected = @expected + 1; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi (2) set @val=12; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi (2) @@ -223,20 +339,32 @@ prepare stmt from 'insert into t6(a) value (?)'; set @message="none"; set @val=13; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi (2) set @message="none"; set @val=14; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi (2) @@ -248,21 +376,34 @@ end $$ set @message="none"; set @val=15; +set @expected = @expected + 1; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi (2) set @message="none"; set @val=16; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi (2) @@ -270,40 +411,65 @@ prepare stmt from 'insert into t6(a) value (?)'; set @message="none"; set @val=17; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi (2) set @message="none"; set @val=18; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message t6_bi (2) drop trigger t6_bi; set @message="none"; set @val=19; +set @expected = @expected + 1; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message none set @val=20; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message none @@ -311,38 +477,63 @@ prepare stmt from 'insert into t6(a) value (?)'; set @message="none"; set @val=21; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message none set @val=22; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message none drop trigger t6_bd; set @val=23; +set @expected = @expected + 1; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message none set @val=24; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select @message; @message none @@ -386,9 +577,6 @@ drop table if exists t7_audit; drop procedure if exists audit_proc; drop function if exists audit_func; drop view if exists audit_view; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t7_proc(a int); create table t7_func(a int); create table t7_view(a int); @@ -414,155 +602,294 @@ for each row set NEW.reason="trigger v1"; prepare stmt_proc from 'insert into t7_proc(a) value (?)'; set @val=101; execute stmt_proc using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=102; execute stmt_proc using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop procedure audit_proc; create procedure audit_proc(a int) insert into t7_audit values (NULL, a, "proc v2"); set @val=103; +set @expected = @expected + 1; execute stmt_proc using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=104; execute stmt_proc using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 prepare stmt_func from 'insert into t7_func(a) value (?)'; set @val=201; execute stmt_func using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=202; execute stmt_func using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop function audit_func; create function audit_func() returns varchar(50) return "func v2"; set @val=203; +set @expected = @expected + 1; execute stmt_func using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=204; execute stmt_func using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 prepare stmt_view from 'insert into t7_view(a) value (?)'; set @val=301; execute stmt_view using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=302; execute stmt_view using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop view audit_view; create view audit_view as select "view v2" as reason from dual; set @val=303; +set @expected = @expected + 1; execute stmt_view using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=304; execute stmt_view using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 prepare stmt_table from 'insert into t7_table(a) value (?)'; set @val=401; execute stmt_table using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=402; execute stmt_table using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t7_dependent_table add column comments varchar(100) default NULL; set @val=403; +set @expected = @expected + 1; execute stmt_table using @val; ERROR 21S01: Column count doesn't match value count at row 1 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=404; +set @expected = @expected + 1; execute stmt_table using @val; ERROR 21S01: Column count doesn't match value count at row 1 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t7_dependent_table drop column comments; set @val=405; +set @expected = @expected + 1; execute stmt_table using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -3 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=406; execute stmt_table using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -3 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 prepare stmt_table_trigger from 'insert into t7_table(a) value (?)'; set @val=501; execute stmt_table_trigger using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -3 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=502; execute stmt_table_trigger using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -3 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop trigger t7_table_trigger_bi; create trigger t7_table_trigger_bi before insert on t7_dependent_table for each row set NEW.reason="trigger v2"; set @val=503; +set @expected = @expected + 1; execute stmt_table_trigger using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -4 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=504; execute stmt_table_trigger using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -4 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select * from t7_audit order by new_a; old_a new_a reason NULL 101 proc v1 @@ -601,150 +928,237 @@ drop view audit_view; Testing 8: TABLE -> TEMPORARY TABLE transitions ===================================================================== drop table if exists t8; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t8(a int); prepare stmt from 'select * from t8'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t8; create temporary table t8(a int); +set @expected = @expected + 1; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t8; ===================================================================== Testing 9: TABLE -> VIEW transitions ===================================================================== drop table if exists t9; drop table if exists t9_b; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t9(a int); create table t9_b(a int); prepare stmt from 'select * from t9'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t9; create view t9 as select * from t9_b; +set @expected = @expected + 1; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop view t9; drop table t9_b; ===================================================================== Testing 10: TEMPORARY TABLE -> NOTHING transitions ===================================================================== drop temporary table if exists t10; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create temporary table t10(a int); prepare stmt from 'select * from t10'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop temporary table t10; execute stmt; ERROR 42S02: Table 'test.t10' doesn't exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; ERROR 42S02: Table 'test.t10' doesn't exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 ===================================================================== Testing 11: TEMPORARY TABLE -> TABLE transitions ===================================================================== drop table if exists t11; drop temporary table if exists t11; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t11(a int); insert into t11(a) value (1); create temporary table t11(a int); prepare stmt from 'select * from t11'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop temporary table t11; +set @expected = @expected + 1; execute stmt; a 1 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a 1 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select * from t11; a 1 @@ -753,37 +1167,59 @@ drop table t11; Testing 12: TEMPORARY TABLE -> TEMPORARY TABLE (DDL) transitions ===================================================================== drop temporary table if exists t12; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create temporary table t12(a int); -prepare stmt from 'select * from t12'; +prepare stmt from 'select a from t12'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop temporary table t12; create temporary table t12(a int, b int); +set @expected = @expected + 1; execute stmt; -a b -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +a +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; -a b -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +a +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select * from t12; a b drop table t12; @@ -792,38 +1228,60 @@ Testing 13: TEMPORARY TABLE -> VIEW transitions ===================================================================== drop temporary table if exists t13; drop table if exists t13_b; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create temporary table t13(a int); create table t13_b(a int); prepare stmt from 'select * from t13'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop temporary table t13; create view t13 as select * from t13_b; +set @expected = @expected + 1; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop view t13; drop table t13_b; ===================================================================== @@ -831,75 +1289,120 @@ Testing 14: VIEW -> NOTHING transitions ===================================================================== drop view if exists t14; drop table if exists t14_b; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t14_b(a int); create view t14 as select * from t14_b; prepare stmt from 'select * from t14'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop view t14; +set @expected = @expected + 1; execute stmt; ERROR 42S02: Table 'test.t14' doesn't exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 +set @expected = @expected + 1; execute stmt; ERROR 42S02: Table 'test.t14' doesn't exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t14_b; ===================================================================== Testing 15: VIEW -> TABLE transitions ===================================================================== drop view if exists t15; drop table if exists t15_b; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t15_b(a int); create view t15 as select * from t15_b; prepare stmt from 'select * from t15'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop view t15; create table t15(a int); +set @expected = @expected + 1; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t15_b; drop table t15; ===================================================================== @@ -907,38 +1410,60 @@ Testing 16: VIEW -> TEMPORARY TABLE transitions ===================================================================== drop view if exists t16; drop table if exists t16_b; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t16_b(a int); create view t16 as select * from t16_b; prepare stmt from 'select * from t16'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop view t16; create temporary table t16(a int); +set @expected = @expected + 1; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t16_b; drop temporary table t16; ===================================================================== @@ -946,9 +1471,6 @@ Testing 17: VIEW -> VIEW (DDL) transitions ===================================================================== drop view if exists t17; drop table if exists t17_b; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t17_b(a int); insert into t17_b values (10), (20), (30); create view t17 as select a, 2*a as b, 3*a as c from t17_b; @@ -963,44 +1485,69 @@ a b c 10 20 30 20 40 60 30 60 90 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a b c 10 20 30 20 40 60 30 60 90 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop view t17; -create view t17 as select a, 2*a as b, 10*a as c from t17_b; +create view t17 as select a, 2*a as b, 5*a as c from t17_b; select * from t17; a b c -10 20 100 -20 40 200 -30 60 300 +10 20 50 +20 40 100 +30 60 150 +set @expected = @expected + 1; execute stmt; a b c -10 20 100 -20 40 200 -30 60 300 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +10 20 50 +20 40 100 +30 60 150 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a b c -10 20 100 -20 40 200 -30 60 300 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +10 20 50 +20 40 100 +30 60 150 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t17_b; drop view t17; ===================================================================== @@ -1013,9 +1560,6 @@ drop view if exists t18_view; drop view if exists t18_table; drop function if exists view_func; drop view if exists view_view; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t18(a int); insert into t18 values (1), (2), (3); create function view_func(x int) returns int @@ -1031,117 +1575,192 @@ a b 1 2 2 3 3 4 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt_func; a b 1 2 2 3 3 4 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop function view_func; create function view_func(x int) returns int return x*x; +set @expected = @expected + 1; execute stmt_func; a b 1 1 2 4 3 9 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt_func; a b 1 1 2 4 3 9 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 prepare stmt_view from 'select * from t18_view'; execute stmt_view; a b 1 view v1 2 view v1 3 view v1 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt_view; a b 1 view v1 2 view v1 3 view v1 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop view view_view; create view view_view as select "view v2" as reason from dual; +set @expected = @expected + 1; execute stmt_view; a b 1 view v2 2 view v2 3 view v2 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt_view; a b 1 view v2 2 view v2 3 view v2 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 prepare stmt_table from 'select * from t18_table'; execute stmt_table; a 1 2 3 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt_table; a 1 2 3 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t18 add column comments varchar(50) default NULL; +set @expected = @expected + 1; execute stmt_table; a 1 2 3 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt_table; a 1 2 3 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t18; drop table t18_dependent_table; drop view t18_func; @@ -1153,9 +1772,6 @@ drop view view_view; Testing 19: Special tables (INFORMATION_SCHEMA) ===================================================================== drop procedure if exists proc_19; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; prepare stmt from 'select ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_TYPE from INFORMATION_SCHEMA.ROUTINES where @@ -1164,115 +1780,178 @@ create procedure proc_19() select "hi there"; execute stmt; ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE test proc_19 PROCEDURE -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE test proc_19 PROCEDURE -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop procedure proc_19; create procedure proc_19() select "hi there, again"; execute stmt; ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE test proc_19 PROCEDURE -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE test proc_19 PROCEDURE -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop procedure proc_19; ===================================================================== Testing 20: Special tables (log tables) ===================================================================== -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; prepare stmt from 'select * from mysql.general_log where argument=\'IMPOSSIBLE QUERY STRING\''; execute stmt; event_time user_host thread_id server_id command_type argument -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; event_time user_host thread_id server_id command_type argument -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; event_time user_host thread_id server_id command_type argument -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; event_time user_host thread_id server_id command_type argument -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 ===================================================================== Testing 21: Special tables (system tables) ===================================================================== drop procedure if exists proc_21; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; prepare stmt from 'select type, db, name from mysql.proc where name=\'proc_21\''; create procedure proc_21() select "hi there"; execute stmt; type db name PROCEDURE test proc_21 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; type db name PROCEDURE test proc_21 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop procedure proc_21; create procedure proc_21() select "hi there, again"; execute stmt; type db name PROCEDURE test proc_21 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; type db name PROCEDURE test proc_21 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop procedure proc_21; ===================================================================== Testing 22: Special tables (views temp tables) ===================================================================== drop table if exists t22_b; drop view if exists t22; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t22_b(a int); create algorithm=temptable view t22 as select a*a as a2 from t22_b; show create view t22; @@ -1285,19 +1964,31 @@ a2 1 4 9 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a2 1 4 9 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 insert into t22_b values (4), (5), (6); execute stmt; a2 @@ -1307,10 +1998,16 @@ a2 16 25 36 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a2 1 @@ -1319,10 +2016,16 @@ a2 16 25 36 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t22_b; drop view t22; ===================================================================== @@ -1330,9 +2033,6 @@ Testing 23: Special tables (internal join tables) ===================================================================== drop table if exists t23_a; drop table if exists t23_b; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t23_a(a int); create table t23_b(b int); prepare stmt from 'select * from t23_a join t23_b'; @@ -1349,10 +2049,16 @@ a b 1 30 2 30 3 30 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a b 1 10 @@ -1364,10 +2070,16 @@ a b 1 30 2 30 3 30 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 insert into t23_a values (4); insert into t23_b values (40); execute stmt; @@ -1388,10 +2100,16 @@ a b 2 40 3 40 4 40 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a b 1 10 @@ -1410,45 +2128,72 @@ a b 2 40 3 40 4 40 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t23_a; drop table t23_b; ===================================================================== Testing 24: Special statements ===================================================================== drop table if exists t24_alter; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t24_alter(a int); prepare stmt from 'alter table t24_alter add column b int'; execute stmt; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t24_alter; create table t24_alter(a1 int, a2 int); execute stmt; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t24_alter drop column b; execute stmt; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t24_alter drop column b; execute stmt; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t24_alter; drop table if exists t24_repair; create table t24_repair(a int); @@ -1457,36 +2202,60 @@ prepare stmt from 'repair table t24_repair'; execute stmt; Table Op Msg_type Msg_text test.t24_repair repair status OK -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t24_repair; create table t24_repair(a1 int, a2 int); insert into t24_repair values (1, 10), (2, 20), (3, 30); execute stmt; Table Op Msg_type Msg_text test.t24_repair repair status OK -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t24_repair add column b varchar(50) default NULL; execute stmt; Table Op Msg_type Msg_text test.t24_repair repair status OK -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t24_repair drop column b; execute stmt; Table Op Msg_type Msg_text test.t24_repair repair status OK -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t24_repair; drop table if exists t24_analyze; create table t24_analyze(a int); @@ -1495,36 +2264,60 @@ prepare stmt from 'analyze table t24_analyze'; execute stmt; Table Op Msg_type Msg_text test.t24_analyze analyze status OK -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t24_analyze; create table t24_analyze(a1 int, a2 int); insert into t24_analyze values (1, 10), (2, 20), (3, 30); execute stmt; Table Op Msg_type Msg_text test.t24_analyze analyze status OK -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t24_analyze add column b varchar(50) default NULL; execute stmt; Table Op Msg_type Msg_text test.t24_analyze analyze status OK -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t24_analyze drop column b; execute stmt; Table Op Msg_type Msg_text test.t24_analyze analyze status OK -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t24_analyze; drop table if exists t24_optimize; create table t24_optimize(a int); @@ -1533,176 +2326,308 @@ prepare stmt from 'optimize table t24_optimize'; execute stmt; Table Op Msg_type Msg_text test.t24_optimize optimize status OK -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t24_optimize; create table t24_optimize(a1 int, a2 int); insert into t24_optimize values (1, 10), (2, 20), (3, 30); execute stmt; Table Op Msg_type Msg_text test.t24_optimize optimize status OK -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t24_optimize add column b varchar(50) default NULL; execute stmt; Table Op Msg_type Msg_text test.t24_optimize optimize status OK -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t24_optimize drop column b; execute stmt; Table Op Msg_type Msg_text test.t24_optimize optimize status OK -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t24_optimize; drop procedure if exists changing_proc; prepare stmt from 'show create procedure changing_proc'; execute stmt; ERROR 42000: PROCEDURE changing_proc does not exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; ERROR 42000: PROCEDURE changing_proc does not exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 create procedure changing_proc() begin end; execute stmt; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation changing_proc CREATE DEFINER=`root`@`localhost` PROCEDURE `changing_proc`() begin end latin1 latin1_swedish_ci latin1_swedish_ci -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation changing_proc CREATE DEFINER=`root`@`localhost` PROCEDURE `changing_proc`() begin end latin1 latin1_swedish_ci latin1_swedish_ci -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop procedure changing_proc; create procedure changing_proc(x int, y int) begin end; execute stmt; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation changing_proc CREATE DEFINER=`root`@`localhost` PROCEDURE `changing_proc`(x int, y int) begin end latin1 latin1_swedish_ci latin1_swedish_ci -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation changing_proc CREATE DEFINER=`root`@`localhost` PROCEDURE `changing_proc`(x int, y int) begin end latin1 latin1_swedish_ci latin1_swedish_ci -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop procedure changing_proc; execute stmt; ERROR 42000: PROCEDURE changing_proc does not exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; ERROR 42000: PROCEDURE changing_proc does not exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop function if exists changing_func; prepare stmt from 'show create function changing_func'; execute stmt; ERROR 42000: FUNCTION changing_func does not exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; ERROR 42000: FUNCTION changing_func does not exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 create function changing_func() returns int return 0; execute stmt; Function sql_mode Create Function character_set_client collation_connection Database Collation changing_func CREATE DEFINER=`root`@`localhost` FUNCTION `changing_func`() RETURNS int(11) return 0 latin1 latin1_swedish_ci latin1_swedish_ci -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; Function sql_mode Create Function character_set_client collation_connection Database Collation changing_func CREATE DEFINER=`root`@`localhost` FUNCTION `changing_func`() RETURNS int(11) return 0 latin1 latin1_swedish_ci latin1_swedish_ci -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop function changing_func; create function changing_func(x int, y int) returns int return x+y; execute stmt; Function sql_mode Create Function character_set_client collation_connection Database Collation changing_func CREATE DEFINER=`root`@`localhost` FUNCTION `changing_func`(x int, y int) RETURNS int(11) return x+y latin1 latin1_swedish_ci latin1_swedish_ci -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; Function sql_mode Create Function character_set_client collation_connection Database Collation changing_func CREATE DEFINER=`root`@`localhost` FUNCTION `changing_func`(x int, y int) RETURNS int(11) return x+y latin1 latin1_swedish_ci latin1_swedish_ci -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop function changing_func; execute stmt; ERROR 42000: FUNCTION changing_func does not exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; ERROR 42000: FUNCTION changing_func does not exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table if exists t24_trigger; create table t24_trigger(a int); prepare stmt from 'show create trigger t24_bi;'; execute stmt; ERROR HY000: Trigger does not exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; ERROR HY000: Trigger does not exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 create trigger t24_bi before insert on t24_trigger for each row begin set @message= "t24_bi"; @@ -1714,239 +2639,427 @@ t24_bi CREATE DEFINER=`root`@`localhost` trigger t24_bi before insert on t24_tr begin set @message= "t24_bi"; end latin1 latin1_swedish_ci latin1_swedish_ci -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation t24_bi CREATE DEFINER=`root`@`localhost` trigger t24_bi before insert on t24_trigger for each row begin set @message= "t24_bi"; end latin1 latin1_swedish_ci latin1_swedish_ci -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop trigger t24_bi; create trigger t24_bi before insert on t24_trigger for each row begin set @message= "t24_bi (2)"; end $$ +set @expected = @expected + 1; execute stmt; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation t24_bi CREATE DEFINER=`root`@`localhost` trigger t24_bi before insert on t24_trigger for each row begin set @message= "t24_bi (2)"; end latin1 latin1_swedish_ci latin1_swedish_ci -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation t24_bi CREATE DEFINER=`root`@`localhost` trigger t24_bi before insert on t24_trigger for each row begin set @message= "t24_bi (2)"; end latin1 latin1_swedish_ci latin1_swedish_ci -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop trigger t24_bi; execute stmt; ERROR HY000: Trigger does not exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; ERROR HY000: Trigger does not exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t24_trigger; ===================================================================== Testing 25: Testing the strength of TABLE_SHARE version ===================================================================== drop table if exists t25_num_col; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t25_num_col(a int); -prepare stmt from 'select * from t25_num_col'; +prepare stmt from 'select a from t25_num_col'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t25_num_col add column b varchar(50) default NULL; +set @expected = @expected + 1; execute stmt; -a b -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +a +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; -a b -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +a +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t25_num_col; drop table if exists t25_col_name; create table t25_col_name(a int); prepare stmt from 'select * from t25_col_name'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t25_col_name change a b int; +set @expected = @expected + 1; execute stmt; -b -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +ERROR HY000: Prepared statement result set has changed, rebind needed +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 +set @expected = @expected + 1; execute stmt; -b -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +ERROR HY000: Prepared statement result set has changed, rebind needed +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t25_col_name; drop table if exists t25_col_type; create table t25_col_type(a int); prepare stmt from 'select * from t25_col_type'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t25_col_type change a a varchar(10); +set @expected = @expected + 1; execute stmt; -a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -3 +ERROR HY000: Prepared statement result set has changed, rebind needed +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 +set @expected = @expected + 1; execute stmt; -a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -3 +ERROR HY000: Prepared statement result set has changed, rebind needed +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t25_col_type; drop table if exists t25_col_type_length; create table t25_col_type_length(a varchar(10)); prepare stmt from 'select * from t25_col_type_length'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -3 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -3 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t25_col_type_length change a a varchar(20); +set @expected = @expected + 1; execute stmt; -a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -4 +ERROR HY000: Prepared statement result set has changed, rebind needed +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 +set @expected = @expected + 1; execute stmt; -a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -4 +ERROR HY000: Prepared statement result set has changed, rebind needed +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t25_col_type_length; drop table if exists t25_col_null; create table t25_col_null(a varchar(10)); prepare stmt from 'select * from t25_col_null'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -4 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -4 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t25_col_null change a a varchar(10) NOT NULL; +set @expected = @expected + 1; execute stmt; -a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -5 +ERROR HY000: Prepared statement result set has changed, rebind needed +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 +set @expected = @expected + 1; execute stmt; -a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -5 +ERROR HY000: Prepared statement result set has changed, rebind needed +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t25_col_null; drop table if exists t25_col_default; create table t25_col_default(a int, b int DEFAULT 10); prepare stmt from 'insert into t25_col_default(a) values (?)'; set @val=1; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -5 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=2; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -5 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t25_col_default change b b int DEFAULT 20; set @val=3; +set @expected = @expected + 1; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -5 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 set @val=4; execute stmt using @val; -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -5 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 select * from t25_col_default; a b 1 10 @@ -1959,29 +3072,54 @@ create table t25_index(a varchar(10)); prepare stmt from 'select * from t25_index'; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -5 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -5 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 create index i1 on t25_index(a); +set @expected = @expected + 1; execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -6 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -6 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t25_index; drop table if exists t25_index_unique; create table t25_index_unique(a varchar(10), b varchar(10)); @@ -1996,16 +3134,28 @@ t25_index_unique CREATE TABLE `t25_index_unique` ( prepare stmt from 'select * from t25_index_unique'; execute stmt; a b -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -6 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a b -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -6 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 alter table t25_index_unique drop index i1; create unique index i1 on t25_index_unique(a, b); show create table t25_index_unique; @@ -2015,18 +3165,31 @@ t25_index_unique CREATE TABLE `t25_index_unique` ( `b` varchar(10) DEFAULT NULL, UNIQUE KEY `i1` (`a`,`b`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 +set @expected = @expected + 1; execute stmt; a b -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -7 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a b -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -7 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t25_index_unique; ===================================================================== Testing reported bugs @@ -2035,9 +3198,6 @@ drop table if exists table_12093; drop function if exists func_12093; drop function if exists func_12093_unrelated; drop procedure if exists proc_12093; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table table_12093(a int); create function func_12093() returns int @@ -2055,88 +3215,137 @@ prepare stmt_sp from 'call proc_12093(func_12093())'; execute stmt_sf; func_12093() 0 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt_sp; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop function func_12093_unrelated; drop procedure proc_12093_unrelated; execute stmt_sf; func_12093() 0 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt_sp; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt_sf; func_12093() 0 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt_sp; a -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 deallocate prepare stmt_sf; deallocate prepare stmt_sp; drop table table_12093; drop function func_12093; drop procedure proc_12093; drop function if exists func_21294; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create function func_21294() returns int return 10; prepare stmt from "select func_21294()"; execute stmt; func_21294() 10 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop function func_21294; create function func_21294() returns int return 10; execute stmt; func_21294() 10 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop function func_21294; create function func_21294() returns int return 20; +set @expected = @expected + 1; execute stmt; func_21294() 20 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 deallocate prepare stmt; drop function func_21294; drop table if exists t_27420_100; drop table if exists t_27420_101; drop view if exists v_27420; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t_27420_100(a int); insert into t_27420_100 values (1), (2); create table t_27420_101(a int); @@ -2149,35 +3358,52 @@ execute stmt; X Y 1 1 2 2 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop view v_27420; create table v_27420(X int, Y int); +set @expected = @expected + 1; execute stmt; X Y -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table v_27420; create table v_27420 (a int, b int, filler char(200)); +set @expected = @expected + 1; execute stmt; -a b filler -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -2 +ERROR HY000: Prepared statement result set has changed, rebind needed +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 deallocate prepare stmt; drop table t_27420_100; drop table t_27420_101; drop table v_27420; drop table if exists t_27430_1; drop table if exists t_27430_2; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t_27430_1 (a int not null, oref int not null, key(a)); insert into t_27430_1 values (1, 1), @@ -2199,20 +3425,32 @@ oref a Z 2 2 0 3 1234 0 4 1234 0 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; oref a Z 1 1 1 2 2 0 3 1234 0 4 1234 0 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table t_27430_1, t_27430_2; create table t_27430_1 (a int, oref int, key(a)); insert into t_27430_1 values @@ -2227,35 +3465,38 @@ insert into t_27430_2 values (2,2), (NULL, 3), (NULL, 4); +set @expected = @expected + 1; execute stmt; -oref a Z -1 1 1 -2 2 0 -3 NULL NULL -4 NULL 0 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +ERROR HY000: Prepared statement result set has changed, rebind needed +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 +set @expected = @expected + 1; execute stmt; -oref a Z -1 1 1 -2 2 0 -3 NULL NULL -4 NULL 0 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +ERROR HY000: Prepared statement result set has changed, rebind needed +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 deallocate prepare stmt; drop table t_27430_1; drop table t_27430_2; drop table if exists t_27690_1; drop view if exists v_27690_1; drop table if exists v_27690_2; -SELECT VARIABLE_VALUE from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' -into @base_count ; create table t_27690_1 (a int, b int); insert into t_27690_1 values (1,1),(2,2); create table v_27690_1 as select * from t_27690_1; @@ -2267,34 +3508,59 @@ a b a b 2 2 1 1 1 1 2 2 2 2 2 2 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a b a b 1 1 1 1 2 2 1 1 1 1 2 2 2 2 2 2 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 drop table v_27690_1; execute stmt; ERROR 42S02: Table 'test.v_27690_1' doesn't exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; ERROR 42S02: Table 'test.v_27690_1' doesn't exist -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -0 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 create view v_27690_1 as select A.a, A.b from t_27690_1 A, t_27690_1 B; +set @expected = @expected + 1; execute stmt; a b a b 1 1 1 1 @@ -2305,10 +3571,16 @@ a b a b 2 2 2 2 1 1 2 2 2 2 2 2 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 execute stmt; a b a b 1 1 1 1 @@ -2319,10 +3591,16 @@ a b a b 2 2 2 2 1 1 2 2 2 2 2 2 -SELECT VARIABLE_VALUE - @base_count AS REPREPARED from -INFORMATION_SCHEMA.SESSION_STATUS where variable_name='COM_STMT_REPREPARE' ; -REPREPARED -1 +SELECT CASE (VARIABLE_VALUE - @base_count - @expected) +WHEN 0 THEN "PASSED" + ELSE "FAILED" + END +AS `CHECK`, +(VARIABLE_VALUE - @base_count - @expected) AS `OFFSET` + from INFORMATION_SCHEMA.SESSION_STATUS +where variable_name='COM_STMT_REPREPARE' ; +CHECK OFFSET +PASSED 0 deallocate prepare stmt; drop table t_27690_1; drop view v_27690_1; diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index ce5ae57c125..44ceb7ac159 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -1650,10 +1650,46 @@ a (select count(*) from t2) 3 0 4 0 drop table t1,t2; +# +# Bug#25132 disabled query cache: Qcache_free_blocks = 1 +# +set global query_cache_size=100000; +set global query_cache_size=0; +set global query_cache_type=0; +show status like 'Qcache_free_blocks'; +Variable_name Value +Qcache_free_blocks 0 +Restore default values. set GLOBAL query_cache_type=default; set GLOBAL query_cache_limit=default; set GLOBAL query_cache_min_res_unit=default; set GLOBAL query_cache_size=default; +FLUSH STATUS; +SET GLOBAL query_cache_size=10*1024*1024; +SET @save_concurrent_insert= @@concurrent_insert; +SET GLOBAL concurrent_insert= 0; +CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t1 (c1) VALUES (1), (2); +SHOW GLOBAL VARIABLES LIKE 'concurrent_insert'; +Variable_name Value +concurrent_insert 0 +SHOW STATUS LIKE 'Qcache_hits'; +Variable_name Value +Qcache_hits 0 +SELECT * FROM t1; +c1 +1 +2 +SELECT * FROM t1; +c1 +1 +2 +SHOW STATUS LIKE 'Qcache_hits'; +Variable_name Value +Qcache_hits 1 +DROP TABLE t1; +SET GLOBAL concurrent_insert= @save_concurrent_insert; +SET GLOBAL query_cache_size= default; End of 5.0 tests CREATE TABLE t1 (a ENUM('rainbow')); INSERT INTO t1 VALUES (),(),(),(),(); diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 92db6d8429f..cc5e8d2be96 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -1153,6 +1153,58 @@ explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= ' id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range dateval dateval 4 NULL 2 Using where drop table t1; +CREATE TABLE t1 ( +a varchar(32), index (a) +) DEFAULT CHARSET=latin1 COLLATE=latin1_bin; +INSERT INTO t1 VALUES +('B'), ('A'), ('A'), ('C'), ('B'), ('A'), ('A'); +SELECT a FROM t1 WHERE a='b' OR a='B'; +a +B +B +EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 35 NULL 3 Using where; Using index +DROP TABLE t1; +CREATE TABLE t1 (f1 TINYINT(11) UNSIGNED NOT NULL, PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (127),(254),(0),(1),(255); +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256; +COUNT(*) +5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256.0; +COUNT(*) +5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 255; +COUNT(*) +4 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < -1; +COUNT(*) +0 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -1; +COUNT(*) +5 +DROP TABLE t1; +CREATE TABLE t1 ( f1 TINYINT(11) NOT NULL, PRIMARY KEY (f1)); +INSERT INTO t1 VALUES (127),(126),(0),(-128),(-127); +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128; +COUNT(*) +5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128.0; +COUNT(*) +5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 127; +COUNT(*) +4 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129; +COUNT(*) +5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129.0; +COUNT(*) +5 +SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -128; +COUNT(*) +4 +DROP TABLE t1; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t2 (a int, b int, filler char(100)); diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index d3d7988316e..3feaa6255c1 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -434,3 +434,12 @@ SELECT @x; @x 99 DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,1); +SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a; +ROW(a, 1) IN (SELECT SUM(b), 1) +1 +SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a; +ROW(a, 1) IN (SELECT SUM(b), 3) +0 +DROP TABLE t1; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 2f305f6ec5d..4b2464af688 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -1507,7 +1507,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1'')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 @@ -4313,6 +4313,33 @@ SELECT * FROM t1 WHERE c1 > NULL + 1; c1 DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(10) NOT NULL PRIMARY KEY); +INSERT INTO t1 (a) VALUES ('foo0'), ('bar0'), ('baz0'); +SELECT * FROM t1 WHERE a IN (CONCAT('foo', 0), 'bar'); +a +foo0 +DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT); +CREATE TABLE t2 (a INT, c INT, KEY(a)); +INSERT INTO t1 VALUES (1, 1), (2, 2); +INSERT INTO t2 VALUES (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), +(2, 1), (2, 2), (2, 3), (2, 4), (2, 5), +(3, 1), (3, 2), (3, 3), (3, 4), (3, 5), +(4, 1), (4, 2), (4, 3), (4, 4), (4, 5); +FLUSH STATUS; +SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3; +b +1 +2 +SHOW STATUS LIKE 'Handler_read%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 2 +Handler_read_next 0 +Handler_read_prev 0 +Handler_read_rnd 0 +Handler_read_rnd_next 6 +DROP TABLE t1, t2; End of 5.0 tests create table t1(a INT, KEY (a)); INSERT INTO t1 VALUES (1),(2),(3),(4),(5); diff --git a/mysql-test/r/shm.result b/mysql-test/r/shm.result index b42de1e0f70..36ab17c1e4d 100644 --- a/mysql-test/r/shm.result +++ b/mysql-test/r/shm.result @@ -1505,7 +1505,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1'')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index ff32d2a1512..d1eb213670e 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -662,53 +662,44 @@ t1 NULL NULL NULL NULL # # # # NULL NULL NULL NULL NULL NULL NULL NULL Incorrect show create table t1; ERROR HY000: Incorrect information in file: './test/t1.frm' drop table if exists t1; -CREATE TABLE txt1(a int); -CREATE TABLE tyt2(a int); -CREATE TABLE urkunde(a int); + +# Bug#12183: SHOW OPEN TABLES behavior doesn't match grammar. + +DROP DATABASE IF EXISTS mysqltest1; +CREATE DATABASE mysqltest1; +use mysqltest1; + +CREATE TABLE t1(a INT); +CREATE TABLE t2(a INT); + FLUSH TABLES; -SELECT 1 FROM mysql.db, mysql.proc, mysql.user, mysql.time_zone, mysql.time_zone_name, txt1, tyt2, urkunde LIMIT 0; + +SELECT 1 FROM t1; 1 -SHOW OPEN TABLES; +SELECT 1 FROM t2; +1 + +SHOW OPEN TABLES FROM mysqltest1; Database Table In_use Name_locked -mysql db 0 0 -test urkunde 0 0 -mysql time_zone 0 0 -mysql general_log 0 0 -test txt1 0 0 -mysql proc 0 0 -test tyt2 0 0 -mysql user 0 0 -mysql time_zone_name 0 0 -SHOW OPEN TABLES FROM mysql; +mysqltest1 t1 0 0 +mysqltest1 t2 0 0 + +SHOW OPEN TABLES FROM mysqltest1 LIKE 'z%'; Database Table In_use Name_locked -mysql db 0 0 -mysql time_zone 0 0 -mysql general_log 0 0 -mysql proc 0 0 -mysql user 0 0 -mysql time_zone_name 0 0 -SHOW OPEN TABLES FROM mysql LIKE 'u%'; + +SHOW OPEN TABLES FROM mysqltest1 LIKE 't1%'; Database Table In_use Name_locked -mysql user 0 0 -SHOW OPEN TABLES LIKE 't%'; +mysqltest1 t1 0 0 + +SHOW OPEN TABLES FROM mysqltest1 LIKE '%1%'; Database Table In_use Name_locked -mysql time_zone 0 0 -test txt1 0 0 -test tyt2 0 0 -mysql time_zone_name 0 0 -SHOW OPEN TABLES LIKE '%o%'; -Database Table In_use Name_locked -mysql time_zone 0 0 -mysql general_log 0 0 -mysql proc 0 0 -mysql time_zone_name 0 0 +mysqltest1 t1 0 0 + FLUSH TABLES; -SHOW OPEN TABLES; -Database Table In_use Name_locked -mysql general_log 0 0 -DROP TABLE txt1; -DROP TABLE tyt2; -DROP TABLE urkunde; + +DROP DATABASE mysqltest1; +use test; + SHOW TABLES FROM non_existing_database; ERROR 42000: Unknown database 'non_existing_database' End of 4.1 tests @@ -1075,7 +1066,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def VIEWS TABLE_CATALOG TABLE_CATALOG 253 1536 0 Y 0 0 33 def VIEWS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 def VIEWS TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 -def VIEWS VIEW_DEFINITION VIEW_DEFINITION 252 589815 8 N 17 0 33 +def VIEWS VIEW_DEFINITION VIEW_DEFINITION 252 589815 15 N 17 0 33 def VIEWS CHECK_OPTION CHECK_OPTION 253 24 4 N 1 0 33 def VIEWS IS_UPDATABLE IS_UPDATABLE 253 9 2 N 1 0 33 def VIEWS DEFINER DEFINER 253 231 14 N 1 0 33 @@ -1083,7 +1074,7 @@ def VIEWS SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 def VIEWS CHARACTER_SET_CLIENT CHARACTER_SET_CLIENT 253 96 6 N 1 0 33 def VIEWS COLLATION_CONNECTION COLLATION_CONNECTION 253 96 6 N 1 0 33 TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION -NULL test v1 SELECT 1 NONE NO root@localhost DEFINER binary binary +NULL test v1 select 1 AS `1` NONE NO root@localhost DEFINER binary binary ---------------------------------------------------------------- SHOW CREATE PROCEDURE p1; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr @@ -1404,7 +1395,7 @@ CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT ' set names utf8; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _koi8r'теÑÑ‚' AS `test` koi8r koi8r_general_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'теÑÑ‚' AS `test` koi8r koi8r_general_ci SHOW CREATE PROCEDURE p1; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() @@ -1427,4 +1418,9 @@ DROP FUNCTION f1; DROP TABLE t1; DROP EVENT ev1; SHOW TABLE TYPES; +CREATE USER test_u@localhost; +GRANT PROCESS ON *.* TO test_u@localhost; +SHOW ENGINE MYISAM MUTEX; +SHOW ENGINE MYISAM STATUS; +DROP USER test_u@localhost; End of 5.1 tests diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result index ca5c5b42102..39770dc4f2a 100644 --- a/mysql-test/r/sp-code.result +++ b/mysql-test/r/sp-code.result @@ -324,29 +324,29 @@ Pos Instruction 0 set str@1 NULL 1 set_case_expr (12) 0 i@0 2 jump_if_not 5(12) (case_expr@0 = 1) -3 set str@1 _latin1'1' +3 set str@1 '1' 4 jump 12 5 jump_if_not 8(12) (case_expr@0 = 2) -6 set str@1 _latin1'2' +6 set str@1 '2' 7 jump 12 8 jump_if_not 11(12) (case_expr@0 = 3) -9 set str@1 _latin1'3' +9 set str@1 '3' 10 jump 12 -11 set str@1 _latin1'unknown' +11 set str@1 'unknown' 12 stmt 0 "SELECT str" SHOW PROCEDURE CODE proc_19194_searched; Pos Instruction 0 set str@1 NULL 1 jump_if_not 4(11) (i@0 = 1) -2 set str@1 _latin1'1' +2 set str@1 '1' 3 jump 11 4 jump_if_not 7(11) (i@0 = 2) -5 set str@1 _latin1'2' +5 set str@1 '2' 6 jump 11 7 jump_if_not 10(11) (i@0 = 3) -8 set str@1 _latin1'3' +8 set str@1 '3' 9 jump 11 -10 set str@1 _latin1'unknown' +10 set str@1 'unknown' 11 stmt 0 "SELECT str" SHOW PROCEDURE CODE proc_19194_nested_1; Pos Instruction @@ -354,59 +354,59 @@ Pos Instruction 1 set str_j@3 NULL 2 set_case_expr (27) 0 i@0 3 jump_if_not 6(27) (case_expr@0 = 10) -4 set str_i@2 _latin1'10' +4 set str_i@2 '10' 5 jump 27 6 jump_if_not 20(27) (case_expr@0 = 20) -7 set str_i@2 _latin1'20' +7 set str_i@2 '20' 8 jump_if_not 11(18) (j@1 = 1) -9 set str_j@3 _latin1'1' +9 set str_j@3 '1' 10 jump 18 11 jump_if_not 14(18) (j@1 = 2) -12 set str_j@3 _latin1'2' +12 set str_j@3 '2' 13 jump 18 14 jump_if_not 17(18) (j@1 = 3) -15 set str_j@3 _latin1'3' +15 set str_j@3 '3' 16 jump 18 -17 set str_j@3 _latin1'unknown' +17 set str_j@3 'unknown' 18 stmt 0 "select "i was 20"" 19 jump 27 20 jump_if_not 23(27) (case_expr@0 = 30) -21 set str_i@2 _latin1'30' +21 set str_i@2 '30' 22 jump 27 23 jump_if_not 26(27) (case_expr@0 = 40) -24 set str_i@2 _latin1'40' +24 set str_i@2 '40' 25 jump 27 -26 set str_i@2 _latin1'unknown' +26 set str_i@2 'unknown' 27 stmt 0 "SELECT str_i, str_j" SHOW PROCEDURE CODE proc_19194_nested_2; Pos Instruction 0 set str_i@2 NULL 1 set str_j@3 NULL 2 jump_if_not 5(27) (i@0 = 10) -3 set str_i@2 _latin1'10' +3 set str_i@2 '10' 4 jump 27 5 jump_if_not 20(27) (i@0 = 20) -6 set str_i@2 _latin1'20' +6 set str_i@2 '20' 7 set_case_expr (18) 0 j@1 8 jump_if_not 11(18) (case_expr@0 = 1) -9 set str_j@3 _latin1'1' +9 set str_j@3 '1' 10 jump 18 11 jump_if_not 14(18) (case_expr@0 = 2) -12 set str_j@3 _latin1'2' +12 set str_j@3 '2' 13 jump 18 14 jump_if_not 17(18) (case_expr@0 = 3) -15 set str_j@3 _latin1'3' +15 set str_j@3 '3' 16 jump 18 -17 set str_j@3 _latin1'unknown' +17 set str_j@3 'unknown' 18 stmt 0 "select "i was 20"" 19 jump 27 20 jump_if_not 23(27) (i@0 = 30) -21 set str_i@2 _latin1'30' +21 set str_i@2 '30' 22 jump 27 23 jump_if_not 26(27) (i@0 = 40) -24 set str_i@2 _latin1'40' +24 set str_i@2 '40' 25 jump 27 -26 set str_i@2 _latin1'unknown' +26 set str_i@2 'unknown' 27 stmt 0 "SELECT str_i, str_j" SHOW PROCEDURE CODE proc_19194_nested_3; Pos Instruction @@ -414,59 +414,59 @@ Pos Instruction 1 set str_j@3 NULL 2 set_case_expr (28) 0 i@0 3 jump_if_not 6(28) (case_expr@0 = 10) -4 set str_i@2 _latin1'10' +4 set str_i@2 '10' 5 jump 28 6 jump_if_not 21(28) (case_expr@0 = 20) -7 set str_i@2 _latin1'20' +7 set str_i@2 '20' 8 set_case_expr (19) 1 j@1 9 jump_if_not 12(19) (case_expr@1 = 1) -10 set str_j@3 _latin1'1' +10 set str_j@3 '1' 11 jump 19 12 jump_if_not 15(19) (case_expr@1 = 2) -13 set str_j@3 _latin1'2' +13 set str_j@3 '2' 14 jump 19 15 jump_if_not 18(19) (case_expr@1 = 3) -16 set str_j@3 _latin1'3' +16 set str_j@3 '3' 17 jump 19 -18 set str_j@3 _latin1'unknown' +18 set str_j@3 'unknown' 19 stmt 0 "select "i was 20"" 20 jump 28 21 jump_if_not 24(28) (case_expr@0 = 30) -22 set str_i@2 _latin1'30' +22 set str_i@2 '30' 23 jump 28 24 jump_if_not 27(28) (case_expr@0 = 40) -25 set str_i@2 _latin1'40' +25 set str_i@2 '40' 26 jump 28 -27 set str_i@2 _latin1'unknown' +27 set str_i@2 'unknown' 28 stmt 0 "SELECT str_i, str_j" SHOW PROCEDURE CODE proc_19194_nested_4; Pos Instruction 0 set str_i@2 NULL 1 set str_j@3 NULL 2 jump_if_not 5(26) (i@0 = 10) -3 set str_i@2 _latin1'10' +3 set str_i@2 '10' 4 jump 26 5 jump_if_not 19(26) (i@0 = 20) -6 set str_i@2 _latin1'20' +6 set str_i@2 '20' 7 jump_if_not 10(17) (j@1 = 1) -8 set str_j@3 _latin1'1' +8 set str_j@3 '1' 9 jump 17 10 jump_if_not 13(17) (j@1 = 2) -11 set str_j@3 _latin1'2' +11 set str_j@3 '2' 12 jump 17 13 jump_if_not 16(17) (j@1 = 3) -14 set str_j@3 _latin1'3' +14 set str_j@3 '3' 15 jump 17 -16 set str_j@3 _latin1'unknown' +16 set str_j@3 'unknown' 17 stmt 0 "select "i was 20"" 18 jump 26 19 jump_if_not 22(26) (i@0 = 30) -20 set str_i@2 _latin1'30' +20 set str_i@2 '30' 21 jump 26 22 jump_if_not 25(26) (i@0 = 40) -23 set str_i@2 _latin1'40' +23 set str_i@2 '40' 24 jump 26 -25 set str_i@2 _latin1'unknown' +25 set str_i@2 'unknown' 26 stmt 0 "SELECT str_i, str_j" CALL proc_19194_nested_1(10, 1); str_i str_j @@ -793,7 +793,7 @@ end while; end// show procedure code proc_33618_h; Pos Instruction -0 set count1@1 _latin1'0' +0 set count1@1 '0' 1 set vb@2 NULL 2 set last_row@3 NULL 3 jump_if_not 24(24) (num@0 >= 1) @@ -818,7 +818,7 @@ Pos Instruction 22 jump 3 show procedure code proc_33618_c; Pos Instruction -0 set count1@1 _latin1'0' +0 set count1@1 '0' 1 set vb@2 NULL 2 set last_row@3 NULL 3 jump_if_not 23(23) (num@0 >= 1) @@ -842,6 +842,34 @@ Pos Instruction 21 jump 3 drop procedure proc_33618_h; drop procedure proc_33618_c; +drop procedure if exists p_20906_a; +drop procedure if exists p_20906_b; +create procedure p_20906_a() SET @a=@a+1, @b=@b+1; +show procedure code p_20906_a; +Pos Instruction +0 stmt 31 "SET @a=@a+1" +1 stmt 31 "SET @b=@b+1" +set @a=1; +set @b=1; +call p_20906_a(); +select @a, @b; +@a @b +2 2 +create procedure p_20906_b() SET @a=@a+1, @b=@b+1, @c=@c+1; +show procedure code p_20906_b; +Pos Instruction +0 stmt 31 "SET @a=@a+1" +1 stmt 31 "SET @b=@b+1" +2 stmt 31 "SET @c=@c+1" +set @a=1; +set @b=1; +set @c=1; +call p_20906_b(); +select @a, @b, @c; +@a @b @c +2 2 2 +drop procedure p_20906_a; +drop procedure p_20906_b; End of 5.0 tests. CREATE PROCEDURE p1() BEGIN diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index c33c378340e..5ac61821cea 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -1627,3 +1627,26 @@ end loop label1; end loop; end| ERROR 42000: End-label label1 without match +drop procedure if exists p1; +create procedure p1() +begin +create table t1 (a int) type=MyISAM; +drop table t1; +end| +Warnings: +Warning 1287 The syntax 'TYPE=storage_engine' is deprecated and will be removed in MySQL 5.2. Please use 'ENGINE=storage_engine' instead +call p1(); +call p1(); +drop procedure p1; +drop procedure if exists proc_8759; +create procedure proc_8759() +begin +declare should_be_illegal condition for sqlstate '00000'; +declare continue handler for should_be_illegal set @x=0; +end$$ +ERROR 42000: Bad SQLSTATE: '00000' +create procedure proc_8759() +begin +declare continue handler for sqlstate '00000' set @x=0; +end$$ +ERROR 42000: Bad SQLSTATE: '00000' diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index 1a1645ca971..cf26f0076d7 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -357,10 +357,10 @@ ERROR 42000: Access denied; you need the SUPER privilege for this operation use mysqltest; CREATE DEFINER='a @ b @ c'@localhost PROCEDURE wl2897_p3() SELECT 3; Warnings: -Note 1449 There is no 'a @ b @ c'@'localhost' registered +Note 1449 The user specified as a definer ('a @ b @ c'@'localhost') does not exist CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3; Warnings: -Note 1449 There is no 'a @ b @ c'@'localhost' registered +Note 1449 The user specified as a definer ('a @ b @ c'@'localhost') does not exist ---> connection: con1root use mysqltest; @@ -420,9 +420,9 @@ DROP USER mysqltest_1@localhost; ---> connection: mysqltest_2_con use mysqltest; CALL bug13198_p1(); -ERROR HY000: There is no 'mysqltest_1'@'localhost' registered +ERROR HY000: The user specified as a definer ('mysqltest_1'@'localhost') does not exist SELECT bug13198_f1(); -ERROR HY000: There is no 'mysqltest_1'@'localhost' registered +ERROR HY000: The user specified as a definer ('mysqltest_1'@'localhost') does not exist ---> connection: root DROP USER mysqltest_2@localhost; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 50ece83b258..0a2c9a2da85 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -6862,6 +6862,23 @@ end// call proc_33618(20); drop table t_33618; drop procedure proc_33618; +# +# Bug#30787: Stored function ignores user defined alias. +# +use test; +drop function if exists func30787; +create table t1(f1 int); +insert into t1 values(1),(2); +create function func30787(p1 int) returns int +begin +return p1; +end | +select (select func30787(f1)) as ttt from t1; +ttt +1 +2 +drop function func30787; +drop table t1; # ------------------------------------------------------------------ # -- End of 5.0 tests # ------------------------------------------------------------------ @@ -6963,6 +6980,22 @@ END latin1 latin1_swedish_ci latin1_swedish_ci DROP FUNCTION f1; +drop procedure if exists p; +set @old_mode= @@sql_mode; +set @@sql_mode= pow(2,32)-1; +select @@sql_mode into @full_mode; +create procedure p() begin end; +call p(); +select @@sql_mode; +@@sql_mode +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,?,ONLY_FULL_GROUP_BY,NO_UNSIGNED_SUBTRACTION,NO_DIR_IN_CREATE,POSTGRESQL,ORACLE,MSSQL,DB2,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,MYSQL323,MYSQL40,ANSI,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,HIGH_NOT_PRECEDENCE,NO_ENGINE_SUBSTITUTION,PAD_CHAR_TO_FULL_LENGTH +set @@sql_mode= @old_mode; +select replace(@full_mode, '?', 'NOT_USED') into @full_mode; +select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode; +select name from mysql.proc where name = 'p' and sql_mode = @full_mode; +name +p +drop procedure p; # ------------------------------------------------------------------ # -- End of 5.1 tests # ------------------------------------------------------------------ diff --git a/mysql-test/r/sp_notembedded.result b/mysql-test/r/sp_notembedded.result index 277eea8570e..d15efc6d7d7 100644 --- a/mysql-test/r/sp_notembedded.result +++ b/mysql-test/r/sp_notembedded.result @@ -1,3 +1,5 @@ +set @old_concurrent_insert= @@global.concurrent_insert; +set @@global.concurrent_insert= 0; drop table if exists t1,t3; drop procedure if exists bug4902| create procedure bug4902() @@ -17,11 +19,11 @@ begin show processlist; end| call bug4902_2()| -Id User Host db Command Time State Info -# root localhost test Query # NULL show processlist +show warnings| +Level Code Message call bug4902_2()| -Id User Host db Command Time State Info -# root localhost test Query # NULL show processlist +show warnings| +Level Code Message drop procedure bug4902_2| drop table if exists t1| create table t1 ( @@ -231,3 +233,4 @@ rl_acquirer old drop procedure p1; drop table t1; set session low_priority_updates=default; +set @@global.concurrent_insert= @old_concurrent_insert; diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result index 2b34ff8c021..401340f204c 100644 --- a/mysql-test/r/sql_mode.result +++ b/mysql-test/r/sql_mode.result @@ -496,3 +496,13 @@ xb x xcx drop table t1; SET @@SQL_MODE=@OLD_SQL_MODE; +create user mysqltest_32753@localhost; +set @OLD_SQL_MODE=@@SESSION.SQL_MODE; +set session sql_mode='PAD_CHAR_TO_FULL_LENGTH'; +flush privileges; +select current_user(); +current_user() +mysqltest_32753@localhost +set session sql_mode=@OLD_SQL_MODE; +flush privileges; +drop user mysqltest_32753@localhost; diff --git a/mysql-test/r/ssl.result b/mysql-test/r/ssl.result index 3622fb51c99..9ad515a53a3 100644 --- a/mysql-test/r/ssl.result +++ b/mysql-test/r/ssl.result @@ -1508,7 +1508,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1'')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 diff --git a/mysql-test/r/ssl_compress.result b/mysql-test/r/ssl_compress.result index 3018fce5cad..1bd427a65e2 100644 --- a/mysql-test/r/ssl_compress.result +++ b/mysql-test/r/ssl_compress.result @@ -1511,7 +1511,7 @@ explain extended select count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 100.00 Using where Warnings: -Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> _latin1'')) +Note 1003 select count(0) AS `count(*)`,min(`test`.`t2`.`fld4`) AS `min(fld4)`,max(`test`.`t2`.`fld4`) AS `max(fld4)`,sum(`test`.`t2`.`fld1`) AS `sum(fld1)`,avg(`test`.`t2`.`fld1`) AS `avg(fld1)`,std(`test`.`t2`.`fld1`) AS `std(fld1)`,variance(`test`.`t2`.`fld1`) AS `variance(fld1)` from `test`.`t2` where ((`test`.`t2`.`companynr` = 34) and (`test`.`t2`.`fld4` <> '')) select companynr,count(*),min(fld4),max(fld4),sum(fld1),avg(fld1),std(fld1),variance(fld1) from t2 group by companynr limit 3; companynr count(*) min(fld4) max(fld4) sum(fld1) avg(fld1) std(fld1) variance(fld1) 00 82 Anthony windmills 10355753 126289.6707 115550.9757 13352027981.7087 diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index cc1a2535896..ef58a760297 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -895,7 +895,6 @@ ERROR 22003: Out of range value for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES ('-1.2E-3'); ERROR 22003: Out of range value for column 'col2' at row 1 UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0; -ERROR 22003: Out of range value for column 'col1' at row 3 UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0; ERROR 22012: Division by 0 UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; @@ -923,10 +922,10 @@ SELECT * FROM t1; col1 col2 -2.2e-307 0 1e-303 0 -1.7e+308 1.7e+308 +NULL 1.7e+308 -2.2e-307 0 -2e-307 0 -1.7e+308 1.7e+308 +NULL 1.7e+308 0 NULL 2 NULL NULL NULL @@ -934,6 +933,8 @@ NULL NULL DROP TABLE t1; CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6)); INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello ', 'hello '); +Warnings: +Note 1265 Data truncated for column 'col1' at row 3 INSERT INTO t1 (col1) VALUES ('hellobob'); ERROR 22001: Data too long for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES ('hellobob'); diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 4c7c79dd1c1..cd101e3901b 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -393,13 +393,13 @@ EXPLAIN EXTENDED SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = _latin1'2002-08-03') +Note 1003 select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03') EXPLAIN EXTENDED SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); 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 SUBQUERY t1 index NULL PRIMARY 43 NULL 2 100.00 Using where; Using index Warnings: -Note 1003 select (select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = _latin1'2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` +Note 1003 select (select distinct `test`.`t1`.`date` AS `date` from `test`.`t1` where (`test`.`t1`.`date` = '2002-08-03')) AS `(SELECT DISTINCT date FROM t1 WHERE date='2002-08-03')` SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; date 2002-08-03 @@ -540,13 +540,13 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='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 Select tables optimized away Warnings: -Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = _latin1'1') +Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where (`test`.`t1`.`numeropost` = '1') EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index 2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away Warnings: -Note 1003 select '3' AS `numreponse` from `test`.`t1` where (('1' = _latin1'1')) +Note 1003 select '3' AS `numreponse` from `test`.`t1` where (('1' = '1')) drop table t1; CREATE TABLE t1 (a int(1)); INSERT INTO t1 VALUES (1); @@ -1024,7 +1024,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found 2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found Warnings: -Note 1003 select (select encrypt(_latin1'test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` +Note 1003 select (select encrypt('test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1` EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found @@ -1481,7 +1481,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index 2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key Warnings: -Note 1003 select `test`.`t1`.`s1` AS `s1`,(not((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < _latin1'a2') having trigcond((`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` +Note 1003 select `test`.`t1`.`s1` AS `s1`,(not((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond((`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; create table t2 (a int, b int); create table t3 (a int); @@ -2820,19 +2820,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = _latin1'0') and trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`))))) AS `test` from `test`.`t1` explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Using where 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where ((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = _latin1'N') and ((`test`.`t1`.`one`) = `test`.`t2`.`one`) and ((`test`.`t1`.`two`) = `test`.`t2`.`two`)))) +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` where ((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = 'N') and ((`test`.`t1`.`one`) = `test`.`t2`.`one`) and ((`test`.`t1`.`two`) = `test`.`t2`.`two`)))) explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; Using temporary; Using filesort Warnings: -Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = _latin1'0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`))))) AS `test` from `test`.`t1` +Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,((`test`.`t1`.`one`,`test`.`t1`.`two`),(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond((((`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond((((`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond((`test`.`t2`.`one`)) and trigcond((`test`.`t2`.`two`))))) AS `test` from `test`.`t1` DROP TABLE t1,t2; CREATE TABLE t1 (a char(5), b char(5)); INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa'); diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result index ac492caf89a..89cc3626aa9 100644 --- a/mysql-test/r/subselect3.result +++ b/mysql-test/r/subselect3.result @@ -758,5 +758,16 @@ EXPLAIN SELECT a FROM t1 WHERE a NOT IN (SELECT a FROM t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 4 Using where 2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 Using index; Using where -DROP TABLE t1; +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES(1); +CREATE TABLE t2 (placeholder CHAR(11)); +INSERT INTO t2 VALUES("placeholder"); +SELECT ROW(1, 2) IN (SELECT t1.a, 2) FROM t1 GROUP BY t1.a; +ROW(1, 2) IN (SELECT t1.a, 2) +1 +SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a; +ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) +1 +DROP TABLE t1, t2; End of 5.0 tests diff --git a/mysql-test/r/subselect_notembedded.result b/mysql-test/r/subselect_notembedded.result index 90aadcae398..9ef8c492ee3 100644 --- a/mysql-test/r/subselect_notembedded.result +++ b/mysql-test/r/subselect_notembedded.result @@ -4,101 +4,36 @@ purge master logs before adddate(current_timestamp(), interval -4 day); create table t1(a int,b int,key(a),key(b)); insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5), (6,7),(7,4),(5,3); -select sum(a),a from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 -)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1) -group by a; -sum(a) a -select sum(a),a from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1) -group by a; -ERROR HY000: Thread stack overrun detected -explain select sum(a),a from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 -)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1) -group by a; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index a a 5 NULL 9 Using where; Using index -2 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort -3 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort -4 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort -5 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort -6 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort -7 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort -8 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort -9 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort -10 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort -11 SUBQUERY t1 index a b 5 NULL 9 Using where; Using filesort -12 SUBQUERY t1 range a a 5 NULL 1 Using where; Using temporary; Using filesort -13 SUBQUERY t1 index NULL a 5 NULL 9 Using index -explain select sum(a),a from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 where a> ( select sum(a) from t1 where a> ( -select sum(a) from t1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1 -)group by b limit 1)group by b limit 1)group by b limit 1) -group by a; -ERROR HY000: Thread stack overrun detected +5 +4 +3 +2 +1 +26 +25 +24 +23 +22 +21 +20 +19 +18 +17 +16 +15 +14 +13 +12 +11 +10 +9 +8 +7 +6 +5 +4 +3 +2 +1 drop table t1; +End of 5.1 tests diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index 4eece9d5b5a..bda0d7d1451 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -22,6 +22,7 @@ insert into t1 (b) select b from t2; insert into t2 (b) select b from t1; insert into t1 (b) select b from t2; drop table t2; +create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="MYSQLTEST_VARDIR/tmp" index directory="MYSQLTEST_VARDIR/run"; insert into t9 select * from t1; check table t9; Table Op Msg_type Msg_text @@ -54,10 +55,16 @@ t9 CREATE TABLE `t9` ( `d` int(11) NOT NULL, PRIMARY KEY (`a`) ) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' +create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp"; Got one of the listed errors +create database mysqltest; +create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist"; Got one of the listed errors +create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path"; Got one of the listed errors +create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="MYSQLTEST_VARDIR/run"; Got one of the listed errors +create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="MYSQLTEST_VARDIR/tmp"; Got one of the listed errors alter table t9 rename mysqltest.t9; select count(*) from mysqltest.t9; @@ -74,6 +81,7 @@ t9 CREATE TABLE `t9` ( ) ENGINE=MyISAM AUTO_INCREMENT=16725 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/' drop database mysqltest; create table t1 (a int not null) engine=myisam; +alter table t1 data directory="MYSQLTEST_VARDIR/tmp"; Warnings: Warning 0 DATA DIRECTORY option ignored show create table t1; @@ -82,6 +90,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 alter table t1 add b int; +alter table t1 data directory="MYSQLTEST_VARDIR/log"; Warnings: Warning 0 DATA DIRECTORY option ignored show create table t1; @@ -90,6 +99,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 index directory="MYSQLTEST_VARDIR/log"; Warnings: Warning 0 INDEX DIRECTORY option ignored show create table t1; @@ -100,28 +110,22 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t1(a INT) -DATA DIRECTORY='TEST_DIR/master-data/mysql' -INDEX DIRECTORY='TEST_DIR/master-data/mysql'; -RENAME TABLE t1 TO user; -ERROR HY000: Can't create/write to file 'TEST_DIR/master-data/mysql/user.MYI' (Errcode: 17) -DROP TABLE t1; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -drop table t1; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -drop table t1; +DATA DIRECTORY='TEST_DIR/tmp' +INDEX DIRECTORY='TEST_DIR/tmp'; +Got one of the listed errors +CREATE TABLE t2(a INT) +DATA DIRECTORY='TEST_DIR/tmp' +INDEX DIRECTORY='TEST_DIR/tmp'; +RENAME TABLE t2 TO t1; +ERROR HY000: Can't create/write to file 'TEST_DIR/tmp/t1.MYI' (Errcode: 17) +DROP TABLE t2; +create temporary table t1 (a int) engine=myisam data directory="MYSQLTEST_VARDIR/log" select 9 a; show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/log/' +create temporary table t1 (a int) engine=myisam data directory="MYSQLTEST_VARDIR/log" select 99 a; show create table t1; Table Create Table t1 CREATE TEMPORARY TABLE `t1` ( @@ -139,26 +143,33 @@ a 42 drop table t1; End of 4.1 tests -CREATE DATABASE db1; -CREATE DATABASE db2; -USE db2; -INSERT INTO db2.t1 VALUES (1); -SELECT * FROM db2.t1; -b -1 -RESET QUERY CACHE; -USE db1; SET SESSION keep_files_on_create = TRUE; CREATE TABLE t1 (a INT) ENGINE MYISAM; Got one of the listed errors -CREATE TABLE t3 (a INT) Engine=MyISAM; -INSERT INTO t3 VALUES (1),(2),(3); -TRUNCATE TABLE t3; -SELECT * from t3; -a -SET SESSION keep_files_on_create = DEFAULT; -DROP TABLE db2.t1, db1.t3; -DROP DATABASE db1; -DROP DATABASE db2; -USE test; +SET SESSION keep_files_on_create = FALSE; +CREATE TABLE t1 (a INT) ENGINE MYISAM; +DROP TABLE t1; End of 5.0 tests +CREATE TABLE t1(a INT) +INDEX DIRECTORY='TEST_DIR/master-data/mysql'; +ERROR HY000: Incorrect arguments to INDEX DIRECTORY +CREATE TABLE t1(a INT) +DATA DIRECTORY='TEST_DIR/master-data/test'; +ERROR HY000: Incorrect arguments to DATA DIRECTORY +CREATE TABLE t1(a INT) +DATA DIRECTORY='TEST_DIR/master-data/'; +ERROR HY000: Incorrect arguments to DATA DIRECTORY +CREATE TABLE t1(a INT) +INDEX DIRECTORY='TEST_DIR/master-data'; +ERROR HY000: Incorrect arguments to INDEX DIRECTORY +CREATE TABLE t1(a INT) +INDEX DIRECTORY='TEST_DIR/master-data_var'; +ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errcode: 2) +SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE'; +CREATE TABLE t1(a INT) DATA DIRECTORY='MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp'; +Warnings: +Warning 0 DATA DIRECTORY option ignored +Warning 0 INDEX DIRECTORY option ignored +DROP TABLE t1; +SET @@SQL_MODE=@OLD_SQL_MODE; +End of 5.1 tests diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index d1aff0fa657..171b53ebf09 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -201,7 +201,7 @@ proc CREATE TABLE `proc` ( `definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') NOT NULL DEFAULT '', + `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, @@ -226,7 +226,7 @@ event CREATE TABLE `event` ( `ends` datetime DEFAULT NULL, `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED', `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') NOT NULL DEFAULT '', + `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `originator` int(10) NOT NULL, `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', diff --git a/mysql-test/r/tablelock.result b/mysql-test/r/tablelock.result index 2ffd8f928a9..6923ad40916 100644 --- a/mysql-test/r/tablelock.result +++ b/mysql-test/r/tablelock.result @@ -46,3 +46,12 @@ CREATE TABLE t2 (a int); lock tables t1 write,t1 as b write, t2 write, t2 as c read; drop table t2,t1; unlock tables; +create temporary table t1(f1 int); +lock tables t1 write; +insert into t1 values (1); +show columns from t1; +Field Type Null Key Default Extra +f1 int(11) YES NULL +insert into t1 values(2); +drop table t1; +unlock tables; diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 46724de4281..6df09463d02 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -112,7 +112,7 @@ v1 CREATE TEMPORARY TABLE `v1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show create view v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'This is view' AS `A` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'This is view' AS `A` latin1 latin1_swedish_ci drop view v1; select * from v1; A @@ -184,3 +184,14 @@ select * from t1; a 42 drop table t1; +CREATE TEMPORARY TABLE t1(a INT, b VARCHAR(20)); +INSERT INTO t1 VALUES(1, 'val1'), (2, 'val2'), (3, 'val3'); +DELETE FROM t1 WHERE a=1; +SELECT count(*) FROM t1; +count(*) +2 +DELETE FROM t1; +SELECT * FROM t1; +a b +DROP TABLE t1; +End of 5.1 tests diff --git a/mysql-test/r/trigger-trans.result b/mysql-test/r/trigger-trans.result index cd5f629564f..dccaa27c5fd 100644 --- a/mysql-test/r/trigger-trans.result +++ b/mysql-test/r/trigger-trans.result @@ -140,4 +140,23 @@ select * from t3; c 1 drop table t1, t2, t3; +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=innodb; +CREATE TABLE t2(b INT, FOREIGN KEY(b) REFERENCES t1(a)) ENGINE=innodb; +INSERT INTO t1 VALUES (1); +CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW SET @a = 1; +CREATE TRIGGER t1_ad AFTER DELETE ON t1 FOR EACH ROW SET @b = 1; +SET @a = 0; +SET @b = 0; +TRUNCATE t1; +SELECT @a, @b; +@a @b +0 0 +INSERT INTO t1 VALUES (1); +DELETE FROM t1; +SELECT @a, @b; +@a @b +1 1 +DROP TABLE t2, t1; End of 5.0 tests diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 8b384dfdc4e..e7f5c41513b 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -2016,4 +2016,42 @@ i j 10 10 unlock tables; drop table t1; +drop table if exists t1, t2; +drop trigger if exists trg1; +drop trigger if exists trg2; +create table t1 (a int); +create table t2 (b int); +create trigger trg1 after update on t1 for each row set @a= @a+1; +create trigger trg2 after update on t2 for each row set @b= @b+1; +insert into t1 values (1), (2), (3); +insert into t2 values (1), (2), (3); +set @a= 0; +set @b= 0; +update t1, t2 set t1.a= t1.a, t2.b= t2.b; +select @a, @b; +@a @b +3 3 +update t1, t2 set t1.a= t2.b, t2.b= t1.a; +select @a, @b; +@a @b +6 6 +update t1 set a= a; +select @a, @b; +@a @b +9 6 +update t2 set b= b; +select @a, @b; +@a @b +9 9 +update t1 set a= 1; +select @a, @b; +@a @b +12 9 +update t2 set b= 1; +select @a, @b; +@a @b +12 12 +drop trigger trg1; +drop trigger trg2; +drop table t1, t2; End of 5.1 tests. diff --git a/mysql-test/r/trigger_notembedded.result b/mysql-test/r/trigger_notembedded.result index 87e8f68da38..1e13bff03b1 100644 --- a/mysql-test/r/trigger_notembedded.result +++ b/mysql-test/r/trigger_notembedded.result @@ -133,9 +133,9 @@ CREATE DEFINER='mysqltest_nonexs'@'localhost' FOR EACH ROW SET @new_sum = 0; Warnings: -Note 1449 There is no 'mysqltest_nonexs'@'localhost' registered +Note 1449 The user specified as a definer ('mysqltest_nonexs'@'localhost') does not exist INSERT INTO t1 VALUES(6); -ERROR HY000: There is no 'mysqltest_nonexs'@'localhost' registered +ERROR HY000: The user specified as a definer ('mysqltest_nonexs'@'localhost') does not exist SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/r/type_binary.result b/mysql-test/r/type_binary.result index 432c58272a2..00f4183aec3 100644 --- a/mysql-test/r/type_binary.result +++ b/mysql-test/r/type_binary.result @@ -125,6 +125,7 @@ create table t1 (c char(2), vc varchar(2)); insert into t1 values(0x4120, 0x4120); insert into t1 values(0x412020, 0x412020); Warnings: +Note 1265 Data truncated for column 'c' at row 1 Note 1265 Data truncated for column 'vc' at row 1 drop table t1; set @old_sql_mode= @@sql_mode, sql_mode= 'traditional'; diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index c98c8c5b68c..7cf85b9b315 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -519,7 +519,7 @@ coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')); 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 charset(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,collation(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,coercibility(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))` +Note 1003 select charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))` update t1 set imagem=load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat') where id=1; select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1; if(imagem is null, "ERROR", "OK") length(imagem) diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index 877400ab7e1..e36f21f2996 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -85,3 +85,12 @@ t1 CREATE TABLE `t1` ( `f1` set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64','1') DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; +CREATE TABLE t1(c set('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50','51','52','53','54','55','56','57','58','59','60','61','62','63','64')); +INSERT INTO t1 VALUES(7); +INSERT INTO t1 VALUES(9223372036854775808); +SELECT * FROM t1; +c +1,2,3 +64 +DROP TABLE t1; +End of 5.0 tests diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result index 44fcfc0c478..3a7d59798ae 100644 --- a/mysql-test/r/user_var-binlog.result +++ b/mysql-test/r/user_var-binlog.result @@ -21,10 +21,14 @@ ROLLBACK/*!*/; SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/; use test/*!*/; SET TIMESTAMP=10000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; INSERT INTO t1 VALUES(@`a b`) /*!*/; SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`/*!*/; diff --git a/mysql-test/r/variables-notembedded.result b/mysql-test/r/variables-notembedded.result new file mode 100644 index 00000000000..48a1719e2c7 --- /dev/null +++ b/mysql-test/r/variables-notembedded.result @@ -0,0 +1,17 @@ +---- Init ---- +set @my_slave_net_timeout =@@global.slave_net_timeout; +---- Test ---- +set global slave_net_timeout=100; +set global sql_slave_skip_counter=100; +show variables like 'slave_compressed_protocol'; +Variable_name Value +slave_compressed_protocol OFF +show variables like 'slave_load_tmpdir'; +Variable_name Value +slave_load_tmpdir SLAVE_LOAD_TMPDIR +show variables like 'slave_skip_errors'; +Variable_name Value +slave_skip_errors 3,100,137,643,1752 +---- Clean Up ---- +set global slave_net_timeout=default; +set global sql_slave_skip_counter= 0; diff --git a/mysql-test/r/variables_debug.result b/mysql-test/r/variables_debug.result new file mode 100644 index 00000000000..9cd133dddb1 --- /dev/null +++ b/mysql-test/r/variables_debug.result @@ -0,0 +1,12 @@ +set debug= 'T'; +select @@debug; +@@debug +T +set debug= '+P'; +select @@debug; +@@debug +P:T +set debug= '-P'; +select @@debug; +@@debug +T diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 09b997797b4..a0af9fdcf1d 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -3061,7 +3061,7 @@ TheEnd TheEnd SHOW CREATE VIEW v1; View Create View character_set_client collation_connection -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'The\ZEnd' AS `TheEnd` latin1 latin1_swedish_ci +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 'The\ZEnd' AS `TheEnd` latin1 latin1_swedish_ci DROP VIEW v1; CREATE TABLE t1 (mydate DATETIME); INSERT INTO t1 VALUES @@ -3613,7 +3613,68 @@ ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default val set @@sql_mode=@old_mode; drop view v1; drop table t1; -End of 5.0 tests. +create table t1 (a int, key(a)); +create table t2 (c int); +create view v1 as select a b from t1; +create view v2 as select 1 a from t2, v1 where c in +(select 1 from t1 where b = a); +insert into t1 values (1), (1); +insert into t2 values (1), (1); +prepare stmt from "select * from v2 where a = 1"; +execute stmt; +a +1 +1 +1 +1 +drop view v1, v2; +drop table t1, t2; +CREATE TABLE t1 (a INT); +CREATE VIEW v1 AS SELECT p.a AS a FROM t1 p, t1 q; +INSERT INTO t1 VALUES (1), (1); +SELECT MAX(a), COUNT(DISTINCT a) FROM v1 GROUP BY a; +MAX(a) COUNT(DISTINCT a) +1 1 +DROP VIEW v1; +DROP TABLE t1; +# ----------------------------------------------------------------- +# -- Bug#34337: Server crash when Altering a view using a table name. +# ----------------------------------------------------------------- + +DROP TABLE IF EXISTS t1; + +CREATE TABLE t1(c1 INT); + +SELECT * FROM t1; +c1 +ALTER ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW t1 (c2) AS SELECT (1); +ERROR HY000: 'test.t1' is not VIEW + +DROP TABLE t1; + +# -- End of test case for Bug#34337. + +# ----------------------------------------------------------------- +# -- Bug#35193: VIEW query is rewritten without "FROM DUAL", +# -- causing syntax error +# ----------------------------------------------------------------- + +CREATE VIEW v1 AS SELECT 1 FROM DUAL WHERE 1; + +SELECT * FROM v1; +1 +1 +SHOW CREATE TABLE v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` from DUAL where 1 latin1 latin1_swedish_ci + +DROP VIEW v1; + +# -- End of test case for Bug#35193. + +# ----------------------------------------------------------------- +# -- End of 5.0 tests. +# ----------------------------------------------------------------- DROP DATABASE IF EXISTS `d-1`; CREATE DATABASE `d-1`; USE `d-1`; @@ -3676,4 +3737,59 @@ DROP TABLE t1; # End of test case for Bug#26676. -End of 5.1 tests. +# ----------------------------------------------------------------- +# -- Bug#32538: View definition picks up character set, but not collation +# ----------------------------------------------------------------- + +DROP VIEW IF EXISTS v1; + +SET collation_connection = latin1_general_ci; +CREATE VIEW v1 AS SELECT _latin1 'text1' AS c1, 'text2' AS c2; + +SELECT COLLATION(c1), COLLATION(c2) FROM v1; +COLLATION(c1) COLLATION(c2) +latin1_swedish_ci latin1_general_ci + +SHOW CREATE VIEW v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'text1' AS `c1`,'text2' AS `c2` latin1 latin1_general_ci + +SELECT * FROM v1 WHERE c1 = 'text1'; +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin1_general_ci,COERCIBLE) for operation '=' + +SELECT * FROM v1 WHERE c2 = 'text2'; +c1 c2 +text1 text2 + +use test; +SET names latin1; + +SELECT COLLATION(c1), COLLATION(c2) FROM v1; +COLLATION(c1) COLLATION(c2) +latin1_swedish_ci latin1_general_ci + +SELECT * FROM v1 WHERE c1 = 'text1'; +c1 c2 +text1 text2 + +SELECT * FROM v1 WHERE c2 = 'text2'; +ERROR HY000: Illegal mix of collations (latin1_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation '=' + +DROP VIEW v1; + +# -- End of test case for Bug#32538. + +drop view if exists a; +drop procedure if exists p; +create procedure p() +begin +declare continue handler for sqlexception begin end; +create view a as select 1; +end| +call p(); +call p(); +drop view a; +drop procedure p; +# ----------------------------------------------------------------- +# -- End of 5.1 tests. +# ----------------------------------------------------------------- diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index c301953f508..3585635d0f9 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -469,6 +469,7 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop database mysqltest; drop view if exists v1; +drop table if exists t1; create table t1 as select * from mysql.user where user=''; delete from mysql.user where user=''; flush privileges; @@ -514,10 +515,10 @@ drop user mysqltest_1@localhost; drop database mysqltest; create definer=some_user@`` sql security invoker view v1 as select 1; Warnings: -Note 1449 There is no 'some_user'@'' registered +Note 1449 The user specified as a definer ('some_user'@'') does not exist create definer=some_user@localhost sql security invoker view v2 as select 1; Warnings: -Note 1449 There is no 'some_user'@'localhost' registered +Note 1449 The user specified as a definer ('some_user'@'localhost') does not exist show create view v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci @@ -600,14 +601,14 @@ CREATE TABLE t1 (a INT PRIMARY KEY); INSERT INTO t1 VALUES (1), (2), (3); CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1; Warnings: -Note 1449 There is no 'no-such-user'@'localhost' registered +Note 1449 The user specified as a definer ('no-such-user'@'localhost') does not exist SHOW CREATE VIEW v; View Create View character_set_client collation_connection v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `test`.`t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci Warnings: Warning 1356 View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them SELECT * FROM v; -ERROR HY000: There is no 'no-such-user'@'localhost' registered +ERROR HY000: The user specified as a definer ('no-such-user'@'localhost') does not exist DROP VIEW v; DROP TABLE t1; USE test; @@ -721,7 +722,7 @@ SELECT * FROM v1; ERROR 42000: SELECT command denied to user 'inv_17254'@'localhost' for table 'v1' for a superuser SELECT * FROM v1; -ERROR HY000: There is no 'def_17254'@'localhost' registered +ERROR HY000: The user specified as a definer ('def_17254'@'localhost') does not exist DROP USER inv_17254@localhost; DROP DATABASE db17254; DROP DATABASE IF EXISTS mysqltest_db1; @@ -931,7 +932,7 @@ View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci ALTER DEFINER=no_such@user_1 VIEW v1 AS SELECT * FROM t1; Warnings: -Note 1449 There is no 'no_such'@'user_1' registered +Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci @@ -939,7 +940,7 @@ Warnings: Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; Warnings: -Note 1449 There is no 'no_such'@'user_1' registered +Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci @@ -947,7 +948,7 @@ Warnings: Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1; Warnings: -Note 1449 There is no 'no_such'@'user_2' registered +Note 1449 The user specified as a definer ('no_such'@'user_2') does not exist SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`no_such`@`user_2` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 249cd583345..653309efa42 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -276,4 +276,42 @@ DROP TABLE t3; DROP PROCEDURE sp1; DROP PROCEDURE sp2; DROP PROCEDURE sp3; +create table t1 (c_char char(255), c_varchar varchar(255), c_tinytext tinytext); +create table t2 (c_tinyblob tinyblob); +set @c = repeat(' ', 256); +set @q = repeat('q', 256); +set sql_mode = ''; +insert into t1 values(@c, @c, @c); +Warnings: +Note 1265 Data truncated for column 'c_char' at row 1 +Note 1265 Data truncated for column 'c_varchar' at row 1 +Note 1265 Data truncated for column 'c_tinytext' at row 1 +insert into t2 values(@c); +Warnings: +Warning 1265 Data truncated for column 'c_tinyblob' at row 1 +insert into t1 values(@q, @q, @q); +Warnings: +Warning 1265 Data truncated for column 'c_char' at row 1 +Warning 1265 Data truncated for column 'c_varchar' at row 1 +Warning 1265 Data truncated for column 'c_tinytext' at row 1 +insert into t2 values(@q); +Warnings: +Warning 1265 Data truncated for column 'c_tinyblob' at row 1 +set sql_mode = 'traditional'; +insert into t1 values(@c, @c, @c); +Warnings: +Note 1265 Data truncated for column 'c_char' at row 1 +Note 1265 Data truncated for column 'c_varchar' at row 1 +Note 1265 Data truncated for column 'c_tinytext' at row 1 +insert into t2 values(@c); +ERROR 22001: Data too long for column 'c_tinyblob' at row 1 +insert into t1 values(@q, NULL, NULL); +ERROR 22001: Data too long for column 'c_char' at row 1 +insert into t1 values(NULL, @q, NULL); +ERROR 22001: Data too long for column 'c_varchar' at row 1 +insert into t1 values(NULL, NULL, @q); +ERROR 22001: Data too long for column 'c_tinytext' at row 1 +insert into t2 values(@q); +ERROR 22001: Data too long for column 'c_tinyblob' at row 1 +drop table t1, t2; End of 5.0 tests diff --git a/mysql-test/std_data/bug33029-slave-relay-bin.000001 b/mysql-test/std_data/bug33029-slave-relay-bin.000001 new file mode 100644 index 00000000000..326d3bb62ab Binary files /dev/null and b/mysql-test/std_data/bug33029-slave-relay-bin.000001 differ diff --git a/mysql-test/std_data/bug35469.dat b/mysql-test/std_data/bug35469.dat new file mode 100644 index 00000000000..afcd9e9cc95 --- /dev/null +++ b/mysql-test/std_data/bug35469.dat @@ -0,0 +1,3 @@ +"1", "string1" +"2", "string2" +"3", "string3" diff --git a/mysql-test/suite/binlog/combinations b/mysql-test/suite/binlog/combinations new file mode 100644 index 00000000000..ea25611a5d4 --- /dev/null +++ b/mysql-test/suite/binlog/combinations @@ -0,0 +1,8 @@ +[row] +--binlog-format=row + +[stmt] +--binlog-format=statement + +[mix] +--binlog-format=mixed diff --git a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result new file mode 100644 index 00000000000..68f1f0b2566 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result @@ -0,0 +1,39 @@ +change master to +MASTER_HOST='dummy.localdomain', +RELAY_LOG_FILE='slave-relay-bin.000001', +RELAY_LOG_POS=4; +start slave sql_thread; +select MASTER_POS_WAIT('master-bin.000001', 3776); +# Result on slave +SELECT * FROM t1; +id +5 +6 +7 +8 +9 +10 +11 +SELECT * FROM t2; +id +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +DROP TABLE IF EXISTS t1, t2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS tr1; +stop slave sql_thread; diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result index 8e5d7def823..72a16010031 100644 --- a/mysql-test/suite/binlog/r/binlog_base64_flag.result +++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result @@ -1,3 +1,4 @@ +DROP TABLE IF EXISTS t1; ==== Test BUG#32407 ==== select * from t1; a @@ -32,14 +33,17 @@ a /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; # at 4 -#ROLLBACK/*!*/; +<#>ROLLBACK/*!*/; # at 102 -#use test/*!*/; +<#>use test/*!*/; SET TIMESTAMP=1196959712/*!*/; -SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +<#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a int) engine= myisam /*!*/; # at 203 diff --git a/mysql-test/suite/binlog/r/binlog_multi_engine.result b/mysql-test/suite/binlog/r/binlog_multi_engine.result index 13227c5ecb1..ffe7915f1f8 100644 --- a/mysql-test/suite/binlog/r/binlog_multi_engine.result +++ b/mysql-test/suite/binlog/r/binlog_multi_engine.result @@ -3,8 +3,8 @@ CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE; CREATE TABLE t1n (e INT, f INT) ENGINE=NDB; RESET MASTER; SET SESSION BINLOG_FORMAT=STATEMENT; -INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); +INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; *** Please look in binlog_multi_engine.test if you have a diff here **** START TRANSACTION; @@ -17,30 +17,28 @@ TRUNCATE t1b; TRUNCATE t1n; show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2) master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2) master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2) master-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c -master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2) master-bin.000001 # Query # # use `test`; UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f master-bin.000001 # Query # # use `test`; UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # use `test`; TRUNCATE t1m -master-bin.000001 # Query # # use `test`; TRUNCATE t1b master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1n) master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; TRUNCATE t1m +master-bin.000001 # Query # # use `test`; TRUNCATE t1b master-bin.000001 # Query # # use `test`; TRUNCATE t1n RESET MASTER; SET SESSION BINLOG_FORMAT=MIXED; -INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); +INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; @@ -52,21 +50,19 @@ TRUNCATE t1b; TRUNCATE t1n; show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2) master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2) master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c -master-bin.000001 # Query # # use `test`; COMMIT -master-bin.000001 # Query # # use `test`; TRUNCATE t1m -master-bin.000001 # Query # # use `test`; TRUNCATE t1b +master-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2) master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1n) master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c +master-bin.000001 # Query # # use `test`; TRUNCATE t1m +master-bin.000001 # Query # # use `test`; TRUNCATE t1b master-bin.000001 # Query # # use `test`; TRUNCATE t1n RESET MASTER; SET SESSION BINLOG_FORMAT=ROW; @@ -82,8 +78,10 @@ UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c; ERROR HY000: Binary logging not possible. Message: Row-based format required for this statement, but not allowed by this combination of engines show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1m) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1n) master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index 6c5c149d48e..f830b69bf9d 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -1072,6 +1072,24 @@ master-bin.000001 30301 Rotate 1 30345 master-bin.000002;pos=4 drop table t1; set global binlog_cache_size=@bcs; set session autocommit = @ac; +drop table if exists t1; +reset master; +create table t1 (a bigint unsigned, b bigint(20) unsigned); +prepare stmt from "insert into t1 values (?,?)"; +set @a= 9999999999999999; +set @b= 14632475938453979136; +execute stmt using @a, @b; +deallocate prepare stmt; +drop table t1; +show binlog events from 0; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 +master-bin.000001 106 Query 1 227 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned) +master-bin.000001 227 Query 1 295 use `test`; BEGIN +master-bin.000001 295 Table_map 1 337 table_id: # (test.t1) +master-bin.000001 337 Write_rows 1 383 table_id: # flags: STMT_END_F +master-bin.000001 383 Query 1 452 use `test`; COMMIT +master-bin.000001 452 Query 1 528 use `test`; drop table t1 End of 5.0 tests reset master; create table t1 (id tinyint auto_increment primary key); @@ -1095,8 +1113,10 @@ use test; show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key) +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; drop table t1 master-bin.000001 # Query # # use `test`; create table t1 (a int) master-bin.000001 # Query # # use `test`; BEGIN @@ -1107,12 +1127,18 @@ master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` ( `a` int(11) DEFAULT NULL ) +master-bin.000001 # Query # # use `mysql`; BEGIN master-bin.000001 # Table_map # # table_id: # (mysql.user) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysql`; COMMIT +master-bin.000001 # Query # # use `mysql`; BEGIN master-bin.000001 # Table_map # # table_id: # (mysql.user) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysql`; COMMIT +master-bin.000001 # Query # # use `mysql`; BEGIN master-bin.000001 # Table_map # # table_id: # (mysql.user) master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysql`; COMMIT drop table t1,t2,t3,tt1; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; @@ -1122,8 +1148,10 @@ insert delayed into t1 values (300); show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key) +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; drop table t1 master-bin.000001 # Query # # use `test`; create table t1 (a int) master-bin.000001 # Query # # use `test`; BEGIN @@ -1134,20 +1162,32 @@ master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` ( `a` int(11) DEFAULT NULL ) +master-bin.000001 # Query # # use `mysql`; BEGIN master-bin.000001 # Table_map # # table_id: # (mysql.user) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysql`; COMMIT +master-bin.000001 # Query # # use `mysql`; BEGIN master-bin.000001 # Table_map # # table_id: # (mysql.user) master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysql`; COMMIT +master-bin.000001 # Query # # use `mysql`; BEGIN master-bin.000001 # Table_map # # table_id: # (mysql.user) master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysql`; COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */ master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT insert delayed into t1 values (null),(null),(null),(null); insert delayed into t1 values (null),(null),(400),(null); 11 == 11 diff --git a/mysql-test/suite/binlog/r/binlog_row_ctype_cp932.result b/mysql-test/suite/binlog/r/binlog_row_ctype_cp932.result index 655100203b5..43108222866 100644 --- a/mysql-test/suite/binlog/r/binlog_row_ctype_cp932.result +++ b/mysql-test/suite/binlog/r/binlog_row_ctype_cp932.result @@ -6,6 +6,8 @@ SET @test_character_set= 'cp932'; SET @test_collation= 'cp932_japanese_ci'; SET @safe_character_set_server= @@character_set_server; SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; SET character_set_server= @test_character_set; SET collation_server= @test_collation; CREATE DATABASE d1; @@ -72,10 +74,27 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp932 +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; DROP DATABASE d1; USE test; SET character_set_server= @safe_character_set_server; SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; set names cp932; set character_set_database = cp932; CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = cp932; @@ -11399,6 +11418,23 @@ cp932_japanese_ci 6109 cp932_japanese_ci 61 cp932_japanese_ci 6120 drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET collation_connection='cp932_bin'; create table t1 select repeat('a',4000) a; delete from t1; @@ -11409,6 +11445,23 @@ cp932_bin 6109 cp932_bin 61 cp932_bin 6120 drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; create table t2 (a char(1)); insert into t2 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); insert into t2 values ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); diff --git a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result index 4f4e7bcedd7..a066928fc13 100644 --- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result @@ -5,13 +5,30 @@ reset master; insert into t2 values (@v); show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t2) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT flush logs; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; ROLLBACK/*!*/; +use test/*!*/; +SET TIMESTAMP=10000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; +SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; +SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; +/*!\C latin1 *//*!*/; +SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; +BEGIN +/*!*/; +SET TIMESTAMP=10000/*!*/; +COMMIT +/*!*/; DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/suite/binlog/r/binlog_row_insert_select.result b/mysql-test/suite/binlog/r/binlog_row_insert_select.result index cd6ddafc47b..d4370c4de12 100644 --- a/mysql-test/suite/binlog/r/binlog_row_insert_select.result +++ b/mysql-test/suite/binlog/r/binlog_row_insert_select.result @@ -8,8 +8,10 @@ insert into t1 select * from t2; ERROR 23000: Duplicate entry '2' for key 'a' show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; ROLLBACK select * from t1; a 1 diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index 63bab2c1169..419aea5b581 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -117,8 +117,10 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t2) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT delete from t1; delete from t2; reset master; @@ -131,8 +133,10 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t2) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT insert into t1 values(11); commit; show binlog events from ; @@ -141,8 +145,10 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t2) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F @@ -272,14 +278,20 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t2) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; drop table t1,t2 master-bin.000001 # Query # # use `test`; create table t0 (n int) +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t0) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t0) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb do release_lock("lock1"); drop table t0,t2; @@ -362,38 +374,52 @@ a b DROP TABLE t1,t2; show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2 +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2 master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; TRUNCATE table t2 master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE t2 +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; TRUNCATE table t2 -master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ reset master; create table t1 (a int) engine=innodb; @@ -489,9 +515,11 @@ insert into t2 values (bug27417(2)); ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t2) master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; ROLLBACK /* only (!) with fixes for #23333 will show there is the query */; select count(*) from t1 /* must be 3 */; count(*) @@ -506,9 +534,11 @@ count(*) 2 show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t2) master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT /* the query must be in regardless of #23333 */; select count(*) from t1 /* must be 5 */; count(*) @@ -564,11 +594,13 @@ update t3 set b=b+bug27417(1); ERROR 23000: Duplicate entry '4' for key 'b' show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t3) master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Update_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; ROLLBACK /* the output must denote there is the query */; select count(*) from t1 /* must be 2 */; count(*) @@ -822,10 +854,8 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=6 master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */ -master-bin.000001 # Query # # use `test`; ROLLBACK select count(*) from t1 /* must be 4 */; count(*) 4 diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index 80908e6b450..20d7281d5cc 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -579,6 +579,21 @@ master-bin.000001 36593 Rotate 1 36637 master-bin.000002;pos=4 drop table t1; set global binlog_cache_size=@bcs; set session autocommit = @ac; +drop table if exists t1; +reset master; +create table t1 (a bigint unsigned, b bigint(20) unsigned); +prepare stmt from "insert into t1 values (?,?)"; +set @a= 9999999999999999; +set @b= 14632475938453979136; +execute stmt using @a, @b; +deallocate prepare stmt; +drop table t1; +show binlog events from 0; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 +master-bin.000001 106 Query 1 227 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned) +master-bin.000001 227 Query 1 351 use `test`; insert into t1 values (9999999999999999,14632475938453979136) +master-bin.000001 351 Query 1 427 use `test`; drop table t1 End of 5.0 tests reset master; create table t1 (id tinyint auto_increment primary key); @@ -633,12 +648,18 @@ master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('An master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@' master-bin.000001 # Query # # use `test`; drop table t1,t2,t3,tt1 master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; COMMIT insert delayed into t1 values (null),(null),(null),(null); insert delayed into t1 values (null),(null),(400),(null); 11 == 11 diff --git a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result index 20e9bf6283e..619fd39a2a9 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result +++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result @@ -73,7 +73,7 @@ explain extended select * from t1 where MATCH(a,b) AGAINST ("collections"); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 fulltext a a 0 1 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against (_latin1'collections')) +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (match `test`.`t1`.`a`,`test`.`t1`.`b` against ('collections')) select * from t1 where MATCH(a,b) AGAINST ("indexes"); a b Full-text indexes are called collections @@ -172,3 +172,26 @@ master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; insert into t1 values(1) master-bin.000001 # Query # # use `test`; COMMIT drop table if exists t1; +reset master; +create table t1 (a int auto_increment, primary key (a)) engine=blackhole; +insert into t1 values (11), (NULL), (NULL), (NULL); +set insert_id= 3; +insert into t1 values (NULL), (33), (NULL); +set insert_id= 5; +insert into t1 values (55), (NULL); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # use `test`; create table t1 (a int auto_increment, primary key (a)) engine=blackhole +master-bin.000001 # Query 1 # use `test`; BEGIN +master-bin.000001 # Intvar 1 # INSERT_ID=1 +master-bin.000001 # Query 1 # use `test`; insert into t1 values (11), (NULL), (NULL), (NULL) +master-bin.000001 # Query 1 # use `test`; COMMIT +master-bin.000001 # Query 1 # use `test`; BEGIN +master-bin.000001 # Intvar 1 # INSERT_ID=3 +master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL), (33), (NULL) +master-bin.000001 # Query 1 # use `test`; COMMIT +master-bin.000001 # Query 1 # use `test`; BEGIN +master-bin.000001 # Intvar 1 # INSERT_ID=5 +master-bin.000001 # Query 1 # use `test`; insert into t1 values (55), (NULL) +master-bin.000001 # Query 1 # use `test`; COMMIT +drop table t1; diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result index 655100203b5..43108222866 100755 --- a/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result @@ -6,6 +6,8 @@ SET @test_character_set= 'cp932'; SET @test_collation= 'cp932_japanese_ci'; SET @safe_character_set_server= @@character_set_server; SET @safe_collation_server= @@collation_server; +SET @safe_character_set_client= @@character_set_client; +SET @safe_character_set_results= @@character_set_results; SET character_set_server= @test_character_set; SET collation_server= @test_collation; CREATE DATABASE d1; @@ -72,10 +74,27 @@ select 1 from t1 order by cast(a as char(1)); 1 1 drop table t1; +set names utf8; +create table t1 ( +name varchar(10), +level smallint unsigned); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `name` varchar(10) DEFAULT NULL, + `level` smallint(5) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp932 +insert into t1 values ('string',1); +select concat(name,space(level)), concat(name, repeat(' ',level)) from t1; +concat(name,space(level)) concat(name, repeat(' ',level)) +string string +drop table t1; DROP DATABASE d1; USE test; SET character_set_server= @safe_character_set_server; SET collation_server= @safe_collation_server; +SET character_set_client= @safe_character_set_client; +SET character_set_results= @safe_character_set_results; set names cp932; set character_set_database = cp932; CREATE TABLE t1(c1 CHAR(1)) DEFAULT CHARACTER SET = cp932; @@ -11399,6 +11418,23 @@ cp932_japanese_ci 6109 cp932_japanese_ci 61 cp932_japanese_ci 6120 drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; SET collation_connection='cp932_bin'; create table t1 select repeat('a',4000) a; delete from t1; @@ -11409,6 +11445,23 @@ cp932_bin 6109 cp932_bin 61 cp932_bin 6120 drop table t1; +CREATE TABLE t1 AS +SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; +ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); +INSERT INTO t1 (a, b) VALUES (1, repeat(0xF1F2,5)); +INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); +INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); +INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +SELECT hex(concat(repeat(0xF1F2, 10), '%')); +hex(concat(repeat(0xF1F2, 10), '%')) +F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F225 +3 rows expected +SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); +a hex(b) c +2 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +3 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +4 F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2F1F2 +DROP TABLE t1; create table t2 (a char(1)); insert into t2 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'); insert into t2 values ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F'); diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result index 3030af7bd68..1b14686a97d 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result @@ -15,10 +15,14 @@ ROLLBACK/*!*/; SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/; use test/*!*/; SET TIMESTAMP=10000/*!*/; +SET @@session.pseudo_thread_id=999999999/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.sql_mode=0/*!*/; +SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/; /*!\C latin1 *//*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; +SET @@session.lc_time_names=0/*!*/; +SET @@session.collation_database=DEFAULT/*!*/; insert into t2 values (@v) /*!*/; DELIMITER ; diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result index 39927a8d866..60104a64d94 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result @@ -251,7 +251,7 @@ master-bin.000001 # Query # # use `test`; drop table t1,t2 master-bin.000001 # Query # # use `test`; create temporary table ti (a int) engine=innodb master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; insert into ti values(1) -master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; create temporary table t1 (a int) engine=myisam master-bin.000001 # Query # # use `test`; insert t1 values (1) master-bin.000001 # Query # # use `test`; create table t0 (n int) @@ -358,11 +358,11 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (8,8) master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (9,9) master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; TRUNCATE table t2 -master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (10,10) master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (100,100) -master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE t1,t2 reset master; create table t1 (a int) engine=innodb; @@ -549,10 +549,8 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=6 master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */ -master-bin.000001 # Query # # use `test`; ROLLBACK /* the output must denote there is the query */; select count(*) from t1 /* must be 4 */; count(*) @@ -788,10 +786,8 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */; ERROR 23000: Duplicate entry '2' for key 'PRIMARY' show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Intvar # # INSERT_ID=6 master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */ -master-bin.000001 # Query # # use `test`; ROLLBACK select count(*) from t1 /* must be 4 */; count(*) 4 diff --git a/mysql-test/suite/binlog/r/binlog_stm_ps.result b/mysql-test/suite/binlog/r/binlog_stm_ps.result index 47934665116..1cf7429987e 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_ps.result +++ b/mysql-test/suite/binlog/r/binlog_stm_ps.result @@ -10,6 +10,8 @@ execute s using @a; prepare s from "insert into t1 select 100 limit ?"; set @a=100; execute s using @a; +Warnings: +Warning 1592 Statement is not safe to log in statement format. show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; create table t1 (a int) diff --git a/mysql-test/suite/binlog/r/binlog_unsafe.result b/mysql-test/suite/binlog/r/binlog_unsafe.result index 8467a18aa6b..cd055e6410e 100644 --- a/mysql-test/suite/binlog/r/binlog_unsafe.result +++ b/mysql-test/suite/binlog/r/binlog_unsafe.result @@ -1,14 +1,223 @@ -SET BINLOG_FORMAT=STATEMENT; -CREATE TABLE t1 (a CHAR(40)); -CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY); -CREATE TABLE t3 (b INT AUTO_INCREMENT PRIMARY KEY); -CREATE VIEW v1(a,b) AS SELECT a,b FROM t2,t3; -INSERT INTO t1 SELECT UUID(); +==== Setup tables ==== +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a CHAR(40)); +CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE trigger_table (a CHAR(7)); +CREATE TABLE trigger_table2 (a INT); +==== Non-deterministic statements ==== +INSERT DELAYED INTO t1 VALUES (5); +==== Some variables that *should* be unsafe ==== +---- Insert directly ---- +INSERT INTO t1 VALUES (@@global.sync_binlog); Warnings: Warning 1592 Statement is not safe to log in statement format. -SHOW WARNINGS; -Level Warning -Code 1592 -Message Statement is not safe to log in statement format. -DROP TABLE t1,t2,t3; DROP VIEW v1; +INSERT INTO t1 VALUES (@@session.insert_id); +Warnings: +Warning 1592 Statement is not safe to log in statement format. +INSERT INTO t1 VALUES (@@global.auto_increment_increment); +Warnings: +Warning 1592 Statement is not safe to log in statement format. +INSERT INTO t2 SELECT UUID(); +Warnings: +Warning 1592 Statement is not safe to log in statement format. +INSERT INTO t2 VALUES (@@session.sql_mode); +Warnings: +Warning 1592 Statement is not safe to log in statement format. +INSERT INTO t2 VALUES (@@global.init_slave); +Warnings: +Warning 1592 Statement is not safe to log in statement format. +INSERT INTO t2 VALUES (@@hostname); +Warnings: +Warning 1592 Statement is not safe to log in statement format. +---- Insert from stored procedure ---- +CREATE PROCEDURE proc() +BEGIN +INSERT INTO t1 VALUES (@@global.sync_binlog); +INSERT INTO t1 VALUES (@@session.insert_id); +INSERT INTO t1 VALUES (@@global.auto_increment_increment); +INSERT INTO t2 SELECT UUID(); +INSERT INTO t2 VALUES (@@session.sql_mode); +INSERT INTO t2 VALUES (@@global.init_slave); +INSERT INTO t2 VALUES (@@hostname); +END| +CALL proc(); +Warnings: +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +---- Insert from stored function ---- +CREATE FUNCTION func() +RETURNS INT +BEGIN +INSERT INTO t1 VALUES (@@global.sync_binlog); +INSERT INTO t1 VALUES (@@session.insert_id); +INSERT INTO t1 VALUES (@@global.auto_increment_increment); +INSERT INTO t2 SELECT UUID(); +INSERT INTO t2 VALUES (@@session.sql_mode); +INSERT INTO t2 VALUES (@@global.init_slave); +INSERT INTO t2 VALUES (@@hostname); +RETURN 0; +END| +SELECT func(); +func() +0 +Warnings: +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +---- Insert from trigger ---- +CREATE TRIGGER trig +BEFORE INSERT ON trigger_table +FOR EACH ROW +BEGIN +INSERT INTO t1 VALUES (@@global.sync_binlog); +INSERT INTO t1 VALUES (@@session.insert_id); +INSERT INTO t1 VALUES (@@global.auto_increment_increment); +INSERT INTO t2 SELECT UUID(); +INSERT INTO t2 VALUES (@@session.sql_mode); +INSERT INTO t2 VALUES (@@global.init_slave); +INSERT INTO t2 VALUES (@@hostname); +END| +INSERT INTO trigger_table VALUES ('bye.'); +Warnings: +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +---- Insert from prepared statement ---- +PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)'; +PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)'; +PREPARE p3 FROM 'INSERT INTO t1 VALUES (@@global.auto_increment_increment)'; +PREPARE p4 FROM 'INSERT INTO t2 SELECT UUID()'; +PREPARE p5 FROM 'INSERT INTO t2 VALUES (@@session.sql_mode)'; +PREPARE p6 FROM 'INSERT INTO t2 VALUES (@@global.init_slave)'; +PREPARE p7 FROM 'INSERT INTO t2 VALUES (@@hostname)'; +EXECUTE p1; +Warnings: +Warning 1592 Statement is not safe to log in statement format. +EXECUTE p2; +Warnings: +Warning 1592 Statement is not safe to log in statement format. +EXECUTE p3; +Warnings: +Warning 1592 Statement is not safe to log in statement format. +EXECUTE p4; +Warnings: +Warning 1592 Statement is not safe to log in statement format. +EXECUTE p5; +Warnings: +Warning 1592 Statement is not safe to log in statement format. +EXECUTE p6; +Warnings: +Warning 1592 Statement is not safe to log in statement format. +EXECUTE p7; +Warnings: +Warning 1592 Statement is not safe to log in statement format. +---- Insert from nested call of triggers / functions / procedures ---- +CREATE PROCEDURE proc1() +INSERT INTO trigger_table VALUES ('ha!')| +CREATE FUNCTION func2() +RETURNS INT +BEGIN +CALL proc1(); +RETURN 0; +END| +CREATE TRIGGER trig3 +BEFORE INSERT ON trigger_table2 +FOR EACH ROW +BEGIN +DECLARE tmp INT; +SELECT func2() INTO tmp; +END| +CREATE PROCEDURE proc4() +INSERT INTO trigger_table2 VALUES (1)| +CREATE FUNCTION func5() +RETURNS INT +BEGIN +CALL proc4; +RETURN 0; +END| +PREPARE prep6 FROM 'SELECT func5()'| +EXECUTE prep6; +func5() +0 +Warnings: +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +==== Variables that should *not* be unsafe ==== +INSERT INTO t1 VALUES (@@session.pseudo_thread_id); +INSERT INTO t1 VALUES (@@session.pseudo_thread_id); +INSERT INTO t1 VALUES (@@session.foreign_key_checks); +INSERT INTO t1 VALUES (@@session.sql_auto_is_null); +INSERT INTO t1 VALUES (@@session.unique_checks); +INSERT INTO t1 VALUES (@@session.auto_increment_increment); +INSERT INTO t1 VALUES (@@session.auto_increment_offset); +INSERT INTO t2 VALUES (@@session.character_set_client); +INSERT INTO t2 VALUES (@@session.collation_connection); +INSERT INTO t2 VALUES (@@session.collation_server); +INSERT INTO t2 VALUES (@@session.time_zone); +INSERT INTO t2 VALUES (@@session.lc_time_names); +INSERT INTO t2 VALUES (@@session.collation_database); +INSERT INTO t2 VALUES (@@session.timestamp); +INSERT INTO t2 VALUES (@@session.last_insert_id); +SET @my_var= 4711; +INSERT INTO t1 VALUES (@my_var); +SET insert_id=12; +INSERT INTO t3 VALUES (NULL); +==== Clean up ==== +DROP PROCEDURE proc; +DROP FUNCTION func; +DROP TRIGGER trig; +DROP PROCEDURE proc1; +DROP FUNCTION func2; +DROP TRIGGER trig3; +DROP PROCEDURE proc4; +DROP FUNCTION func5; +DROP PREPARE prep6; +DROP TABLE t1, t2, t3, trigger_table, trigger_table2; +CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b)); +INSERT INTO t1 SELECT * FROM t1 LIMIT 1; +Warnings: +Warning 1592 Statement is not safe to log in statement format. +REPLACE INTO t1 SELECT * FROM t1 LIMIT 1; +Warnings: +Warning 1592 Statement is not safe to log in statement format. +UPDATE t1 SET a=1 LIMIT 1; +Warnings: +Warning 1592 Statement is not safe to log in statement format. +DELETE FROM t1 LIMIT 1; +Warnings: +Warning 1592 Statement is not safe to log in statement format. +CREATE PROCEDURE p1() +BEGIN +INSERT INTO t1 SELECT * FROM t1 LIMIT 1; +REPLACE INTO t1 SELECT * FROM t1 LIMIT 1; +UPDATE t1 SET a=1 LIMIT 1; +DELETE FROM t1 LIMIT 1; +END| +CALL p1(); +Warnings: +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +Warning 1592 Statement is not safe to log in statement format. +DROP PROCEDURE p1; +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029-master.opt b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029-master.opt new file mode 100644 index 00000000000..74e71a8e558 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029-master.opt @@ -0,0 +1 @@ +--replicate-same-server-id --relay-log=slave-relay-bin --skip-slave-start diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test new file mode 100644 index 00000000000..e77c9398c59 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test @@ -0,0 +1,54 @@ +# BUG#33029 5.0 to 5.1 replication fails on dup key when inserting +# using a trig in SP + +# For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive, +# if one statement in a SP generated AUTO_INCREMENT value by the top +# statement, all statements after it would be considered generated +# AUTO_INCREMENT value by the top statement, and a erroneous INSERT_ID +# value might be associated with these statement, which could cause +# duplicate entry error and stop the slave. + +# Test if the slave can replicate from such a buggy master + +# The bug33029-slave-relay-bin.000001 file is the +# slave-replay-bin.000003 file generated by run the +# rpl_auto_increment_bug33029.test with clean up statements at the end +# of the test case removed on a buggy 5.0 server + +source include/have_log_bin.inc; + +copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLTEST_VARDIR/master-data/slave-relay-bin.000001; + +write_file $MYSQLTEST_VARDIR/master-data/slave-relay-bin.index; +slave-relay-bin.000001 +EOF + +change master to + MASTER_HOST='dummy.localdomain', + RELAY_LOG_FILE='slave-relay-bin.000001', + RELAY_LOG_POS=4; + +start slave sql_thread; +disable_result_log; +select MASTER_POS_WAIT('master-bin.000001', 3776); +enable_result_log; + +echo # Result on slave; +SELECT * FROM t1; +SELECT * FROM t2; + +# clean up +disable_warnings; +DROP TABLE IF EXISTS t1, t2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS tr1; +enable_warnings; + +remove_file $MYSQLTEST_VARDIR/master-data/slave-relay-bin.000001; +remove_file $MYSQLTEST_VARDIR/master-data/slave-relay-bin.index; +stop slave sql_thread; +let $keep_connection=1; +source include/wait_for_slave_sql_to_stop.inc; + diff --git a/mysql-test/suite/binlog/t/binlog_base64_flag.test b/mysql-test/suite/binlog/t/binlog_base64_flag.test index 01f98b8a134..abf35a6bfd8 100644 --- a/mysql-test/suite/binlog/t/binlog_base64_flag.test +++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test @@ -9,6 +9,9 @@ # BINLOG statement does not work in embedded mode. source include/not_embedded.inc; +disable_warnings; +DROP TABLE IF EXISTS t1; +enable_warnings; # Test to show BUG#32407. This reads a binlog created with the # mysql-5.1-telco-6.1 tree, specifically at the tag @@ -70,7 +73,7 @@ select * from t1; --echo ==== Test --base64-output=never on a binlog with row events ==== # mysqlbinlog should fail ---replace_regex /#[0-9][0-9][0-9][0-9][0-9][0-9] .*/#/ +--replace_regex /#[0-9][0-9][0-9][0-9][0-9][0-9] .*/<#>/ /SET \@\@session.pseudo_thread_id.*/<#>/ error 1; exec $MYSQL_BINLOG --base64-output=never suite/binlog/std_data/bug32407.001; # the above line should output the query log event and then stop diff --git a/mysql-test/suite/binlog/t/binlog_multi_engine.test b/mysql-test/suite/binlog/t/binlog_multi_engine.test index 058aca0f715..bf84eed6ec1 100644 --- a/mysql-test/suite/binlog/t/binlog_multi_engine.test +++ b/mysql-test/suite/binlog/t/binlog_multi_engine.test @@ -15,11 +15,16 @@ RESET MASTER; SET SESSION BINLOG_FORMAT=STATEMENT; -INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); +INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; +# Here and below we need to wait when some event appears in binlog +# to avoid unsrted mixing local events and from NDB +let $wait_binlog_event= t1m, t1b; +source include/wait_for_binlog_event.inc; + echo *** Please look in binlog_multi_engine.test if you have a diff here ****; START TRANSACTION; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); @@ -27,20 +32,33 @@ UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c; COMMIT; +let $wait_binlog_event= COMMIT; +source include/wait_for_binlog_event.inc; + TRUNCATE t1m; TRUNCATE t1b; TRUNCATE t1n; +let $wait_binlog_event= t1n; +source include/wait_for_binlog_event.inc; + source include/show_binlog_events.inc; RESET MASTER; SET SESSION BINLOG_FORMAT=MIXED; -INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); +INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); + +let $wait_binlog_event= t1m; +source include/wait_for_binlog_event.inc; + INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); +let $wait_binlog_event= COMMIT; +source include/wait_for_binlog_event.inc; + UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; error ER_BINLOG_LOGGING_IMPOSSIBLE; UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; diff --git a/mysql-test/suite/binlog/t/binlog_stm_ps.test b/mysql-test/suite/binlog/t/binlog_stm_ps.test index 83add5af3d7..55e3d30ad23 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_ps.test +++ b/mysql-test/suite/binlog/t/binlog_stm_ps.test @@ -1,7 +1,7 @@ # This test is to verify replication with PS -- source include/not_embedded.inc --- source include/have_binlog_format_mixed_or_statement.inc +-- source include/have_binlog_format_statement.inc -- disable_query_log reset master; # get rid of previous tests binlog diff --git a/mysql-test/suite/binlog/t/binlog_unsafe.test b/mysql-test/suite/binlog/t/binlog_unsafe.test index 209e16e0cc0..696ded0fd1e 100644 --- a/mysql-test/suite/binlog/t/binlog_unsafe.test +++ b/mysql-test/suite/binlog/t/binlog_unsafe.test @@ -1,17 +1,260 @@ -# Test to check that a warning is generated for unsafe statements -# executed under statement mode logging. +# ==== Purpose ==== +# +# Some statements can not be written to the binlog in a safe manner +# with statement-based replication, either because they rely on +# features that are local to the server they are replicated from +# (e.g., @@variables), or because they include nondeterministic +# queries (e.g., LIMIT), or because the time at which the query is +# executed cannot be determined (e.g., INSERT DELAYED). Such +# statements should be marked unsafe. All unsafe statements should +# give a warning. +# +# This test verifies that a warning is generated for statements that +# should be unsafe, when they are executed under statement mode +# logging. +# +# All variables should be unsafe, with some exceptions. Therefore, +# this test also verifies that the exceptions do *not* generare a +# warning. +# +# +# ==== Method ==== +# +# We try an INSERT DELAYED statement and verify that a warning is +# issued. +# +# We try to insert unsafe variables into a table in several ways: +# directly with an INSERT statement, from a stored procedure, from a +# stored function, from a trigger, from a prepared statement, and from +# a complicated nesting of triggers, functions, procedures, and +# prepared statements. In all cases, a warning should be issued. +# +# We try to insert the variables that should not be unsafe into a +# table, and verify that *no* warning is issued. +# +# +# ==== Related bugs and worklogs ==== +# +# WL#3339: Issue warnings when statement-based replication may fail +# BUG#31168: @@hostname does not replicate +# BUG#34732: mysqlbinlog does not print default values for auto_increment variables +# BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed +# +# +# ==== Related test cases ==== +# +# rpl.rpl_variables verifies that variables which cannot be replicated +# safely in statement mode are replicated correctly in mixed or row +# mode. +# +# rpl.rpl_variables_stm tests the small subset of variables that +# actually can be replicated safely in statement mode. +# +# +# ==== Todo ==== +# +# There are several other ways to create unsafe statements: see, e.g., +# WL#3339, BUG#34768. source include/have_log_bin.inc; +source include/have_binlog_format_statement.inc; -SET BINLOG_FORMAT=STATEMENT; - -CREATE TABLE t1 (a CHAR(40)); -CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY); -CREATE TABLE t3 (b INT AUTO_INCREMENT PRIMARY KEY); -CREATE VIEW v1(a,b) AS SELECT a,b FROM t2,t3; - -INSERT INTO t1 SELECT UUID(); -query_vertical SHOW WARNINGS; - -DROP TABLE t1,t2,t3; DROP VIEW v1; +--echo ==== Setup tables ==== + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a CHAR(40)); +CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE trigger_table (a CHAR(7)); +CREATE TABLE trigger_table2 (a INT); + + +--echo ==== Non-deterministic statements ==== + +INSERT DELAYED INTO t1 VALUES (5); + + +--echo ==== Some variables that *should* be unsafe ==== + +--echo ---- Insert directly ---- + +INSERT INTO t1 VALUES (@@global.sync_binlog); +INSERT INTO t1 VALUES (@@session.insert_id); +INSERT INTO t1 VALUES (@@global.auto_increment_increment); +INSERT INTO t2 SELECT UUID(); +INSERT INTO t2 VALUES (@@session.sql_mode); +INSERT INTO t2 VALUES (@@global.init_slave); +INSERT INTO t2 VALUES (@@hostname); + +--echo ---- Insert from stored procedure ---- + +DELIMITER |; +CREATE PROCEDURE proc() +BEGIN + INSERT INTO t1 VALUES (@@global.sync_binlog); + INSERT INTO t1 VALUES (@@session.insert_id); + INSERT INTO t1 VALUES (@@global.auto_increment_increment); + INSERT INTO t2 SELECT UUID(); + INSERT INTO t2 VALUES (@@session.sql_mode); + INSERT INTO t2 VALUES (@@global.init_slave); + INSERT INTO t2 VALUES (@@hostname); +END| +DELIMITER ;| + +CALL proc(); + +--echo ---- Insert from stored function ---- + +DELIMITER |; +CREATE FUNCTION func() +RETURNS INT +BEGIN + INSERT INTO t1 VALUES (@@global.sync_binlog); + INSERT INTO t1 VALUES (@@session.insert_id); + INSERT INTO t1 VALUES (@@global.auto_increment_increment); + INSERT INTO t2 SELECT UUID(); + INSERT INTO t2 VALUES (@@session.sql_mode); + INSERT INTO t2 VALUES (@@global.init_slave); + INSERT INTO t2 VALUES (@@hostname); + RETURN 0; +END| +DELIMITER ;| + +SELECT func(); + +--echo ---- Insert from trigger ---- + +DELIMITER |; +CREATE TRIGGER trig +BEFORE INSERT ON trigger_table +FOR EACH ROW +BEGIN + INSERT INTO t1 VALUES (@@global.sync_binlog); + INSERT INTO t1 VALUES (@@session.insert_id); + INSERT INTO t1 VALUES (@@global.auto_increment_increment); + INSERT INTO t2 SELECT UUID(); + INSERT INTO t2 VALUES (@@session.sql_mode); + INSERT INTO t2 VALUES (@@global.init_slave); + INSERT INTO t2 VALUES (@@hostname); +END| +DELIMITER ;| + +INSERT INTO trigger_table VALUES ('bye.'); + +--echo ---- Insert from prepared statement ---- + +PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)'; +PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)'; +PREPARE p3 FROM 'INSERT INTO t1 VALUES (@@global.auto_increment_increment)'; +PREPARE p4 FROM 'INSERT INTO t2 SELECT UUID()'; +PREPARE p5 FROM 'INSERT INTO t2 VALUES (@@session.sql_mode)'; +PREPARE p6 FROM 'INSERT INTO t2 VALUES (@@global.init_slave)'; +PREPARE p7 FROM 'INSERT INTO t2 VALUES (@@hostname)'; + +EXECUTE p1; EXECUTE p2; EXECUTE p3; EXECUTE p4; EXECUTE p5; +EXECUTE p6; EXECUTE p7; + +--echo ---- Insert from nested call of triggers / functions / procedures ---- + +DELIMITER |; + +# proc1: cause trigger 'trig' above to be triggered. +CREATE PROCEDURE proc1() + INSERT INTO trigger_table VALUES ('ha!')| + +# func2: call proc1 above. +CREATE FUNCTION func2() +RETURNS INT +BEGIN + CALL proc1(); + RETURN 0; +END| + +# trig3: call func2 above +CREATE TRIGGER trig3 +BEFORE INSERT ON trigger_table2 +FOR EACH ROW +BEGIN + DECLARE tmp INT; + SELECT func2() INTO tmp; +END| + +# proc4: cause trig3 above to be triggered. +CREATE PROCEDURE proc4() + INSERT INTO trigger_table2 VALUES (1)| + +# func5: call proc4 above. +CREATE FUNCTION func5() +RETURNS INT +BEGIN + CALL proc4; + RETURN 0; +END| + +# prep6: call func5() above. +PREPARE prep6 FROM 'SELECT func5()'| + +DELIMITER ;| + +# try a complicated call path to trigger 'trig'. +EXECUTE prep6; + + +--echo ==== Variables that should *not* be unsafe ==== + +INSERT INTO t1 VALUES (@@session.pseudo_thread_id); +INSERT INTO t1 VALUES (@@session.pseudo_thread_id); +INSERT INTO t1 VALUES (@@session.foreign_key_checks); +INSERT INTO t1 VALUES (@@session.sql_auto_is_null); +INSERT INTO t1 VALUES (@@session.unique_checks); +INSERT INTO t1 VALUES (@@session.auto_increment_increment); +INSERT INTO t1 VALUES (@@session.auto_increment_offset); +INSERT INTO t2 VALUES (@@session.character_set_client); +INSERT INTO t2 VALUES (@@session.collation_connection); +INSERT INTO t2 VALUES (@@session.collation_server); +INSERT INTO t2 VALUES (@@session.time_zone); +INSERT INTO t2 VALUES (@@session.lc_time_names); +INSERT INTO t2 VALUES (@@session.collation_database); +INSERT INTO t2 VALUES (@@session.timestamp); +INSERT INTO t2 VALUES (@@session.last_insert_id); +SET @my_var= 4711; +INSERT INTO t1 VALUES (@my_var); + +# using insert_id implicitly should be ok. +SET insert_id=12; +INSERT INTO t3 VALUES (NULL); + + +--echo ==== Clean up ==== + +DROP PROCEDURE proc; +DROP FUNCTION func; +DROP TRIGGER trig; +DROP PROCEDURE proc1; +DROP FUNCTION func2; +DROP TRIGGER trig3; +DROP PROCEDURE proc4; +DROP FUNCTION func5; +DROP PREPARE prep6; +DROP TABLE t1, t2, t3, trigger_table, trigger_table2; +# +# BUG#34768 - nondeterministic INSERT using LIMIT logged in stmt mode if +# binlog_format=mixed +# +CREATE TABLE t1(a INT, b INT, KEY(a), PRIMARY KEY(b)); +INSERT INTO t1 SELECT * FROM t1 LIMIT 1; +REPLACE INTO t1 SELECT * FROM t1 LIMIT 1; +UPDATE t1 SET a=1 LIMIT 1; +DELETE FROM t1 LIMIT 1; +delimiter |; +CREATE PROCEDURE p1() +BEGIN + INSERT INTO t1 SELECT * FROM t1 LIMIT 1; + REPLACE INTO t1 SELECT * FROM t1 LIMIT 1; + UPDATE t1 SET a=1 LIMIT 1; + DELETE FROM t1 LIMIT 1; +END| +delimiter ;| +CALL p1(); +DROP PROCEDURE p1; +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/t/disabled.def b/mysql-test/suite/binlog/t/disabled.def index a6e73fa31d8..888298bbb09 100644 --- a/mysql-test/suite/binlog/t/disabled.def +++ b/mysql-test/suite/binlog/t/disabled.def @@ -9,4 +9,3 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -binlog_multi_engine : Bug#32663 binlog_multi_engine.test fails randomly diff --git a/mysql-test/suite/bugs/r/rpl_bug23533.result b/mysql-test/suite/bugs/r/rpl_bug23533.result new file mode 100644 index 00000000000..1dda75a69b0 --- /dev/null +++ b/mysql-test/suite/bugs/r/rpl_bug23533.result @@ -0,0 +1,23 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +DROP TABLE IF EXISTS t1,t2; +SET AUTOCOMMIT=0; +SET GLOBAL max_binlog_cache_size=4096; +SHOW VARIABLES LIKE 'max_binlog_cache_size'; +Variable_name Value +max_binlog_cache_size 4096 +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b TEXT, PRIMARY KEY(a)) ENGINE=InnoDB; +SELECT COUNT(*) FROM t1; +COUNT(*) +1000 +START TRANSACTION; +CREATE TABLE t2 SELECT * FROM t1; +ERROR HY000: Writing one row to the row-based binary log failed +COMMIT; +SHOW TABLES LIKE 't%'; +Tables_in_test (t%) +t1 diff --git a/mysql-test/suite/bugs/r/rpl_bug31583.result b/mysql-test/suite/bugs/r/rpl_bug31583.result index a5e38e9b2d8..74846607313 100644 --- a/mysql-test/suite/bugs/r/rpl_bug31583.result +++ b/mysql-test/suite/bugs/r/rpl_bug31583.result @@ -13,3 +13,4 @@ a b SELECT * FROM t1 ORDER BY a; a b 3 -3 +DROP TABLE t1; diff --git a/mysql-test/suite/bugs/t/rpl_bug23533.test b/mysql-test/suite/bugs/t/rpl_bug23533.test new file mode 100644 index 00000000000..397f1102f0e --- /dev/null +++ b/mysql-test/suite/bugs/t/rpl_bug23533.test @@ -0,0 +1,43 @@ +############################################################# +# Author: Serge Kozlov +# Date: 02/26/2008 +# Purpose: testing bug report +# Bug#23533: CREATE SELECT max_binlog_cache_size test +# case needed +############################################################# + +--source include/have_innodb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + + +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +--enable_warnings + +SET AUTOCOMMIT=0; +SET GLOBAL max_binlog_cache_size=4096; +SHOW VARIABLES LIKE 'max_binlog_cache_size'; + +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b TEXT, PRIMARY KEY(a)) ENGINE=InnoDB; + +--disable_query_log +let $i= 1000; +while ($i) +{ + eval INSERT INTO t1 VALUES($i, REPEAT('x', 4096)); + dec $i; +} +--enable_query_log + +SELECT COUNT(*) FROM t1; + +# Copied data from t1 into t2 large than max_binlog_cache_size +START TRANSACTION; +--error 1534 +CREATE TABLE t2 SELECT * FROM t1; +COMMIT; +SHOW TABLES LIKE 't%'; + + +# 5.1 End of Test diff --git a/mysql-test/suite/funcs_1/README.txt b/mysql-test/suite/funcs_1/README.txt index e32299dac2d..7e98d1bc117 100644 --- a/mysql-test/suite/funcs_1/README.txt +++ b/mysql-test/suite/funcs_1/README.txt @@ -1,141 +1,46 @@ -Matthias 17.06.2005 -------------------- -1. I changed the database test1 (dropped + created in SP test) - to test4. - Please adjust the SP test cases. -2. There is a difference between my definition of - innodb_tb4 + memory_tb4 - to the latest table definition used by disha. - Please adjust the table definition if needed. -3. The data load files are product of the Disha data generation script - (downloaded ~20 May ?) + modified by Omer - These load data fit fairly to the table definitions. +2008-02-29 Matthias Leich +========================= -4. How to execute the "small" test with 10 rows per table. - Do NOT set the environment variable NO_REFRESH to a - value <> ''. - Start the test for example by - ./mysql-test-run.pl --vardir=/dev/shm/var \ - --force --suite=funcs_1 --do-test=myisam - The "result" files fit mostly to this variant. +1. The testsuite "funcs_1" is mostly intended for additional (compared + to the common regression tests stored in mysql-test/t) checks + of features (VIEWS, INFORMATION_SCHEMA, STORED PROCEDURES,...) + introduced with MySQL 5.0. - Any database not in ('mysql','test') and any tables - needed within a testcase ( t/_.test ) - will be (re)created at the beginning of the test. +2. There were some extensions of this suite when new information_schema + views were introduced. But in most cases the tests for these views + were stored within the regression testsuite (mysql-test/t). -5. How to execute the "big" test with many rows per table. - Replace the directories - suite/funcs_1/data and - suite/funcs_1/r - with the appropriate ones for the "big" test. - Set the environment variable NO_REFRESH to a value <> ''. - Start the test for example by - ./mysql-test-run.pl --vardir=/dev/shm/var \ - --force --suite=funcs_1 --do-test=myisam + INFORMATION_SCHEMA views introduced with MySQL 5.1 + ================================================== + ENGINES (partially tested here) + EVENTS (partially tested here) + FILES + GLOBAL_STATUS + GLOBAL_VARIABLES + PARTITIONS + PLUGINS + PROCESSLIST (full tested here) + PROFILING + REFERENTIAL_CONSTRAINTS + SESSION_STATUS + SESSION_VARIABLES - All databases and tables will be (re)created by the script - __load.test . +3. Some hints: + - SHOW TABLES ... LIKE '' + does a case sensitive comparison between the tablename and + the pattern. + The names of the tables within the informationschema are in uppercase. + So please use something like + SHOW TABLES FOR information_schema LIKE 'TABLES' + when you intend to get the same non empty result set on OS with and + without case sensitive filesystems and default configuration. + - The name of the data dictionary is 'information_schema' (lowercase). + - Server on OS with filesystem with case sensitive filenames + (= The files 'abc' and 'Abc' can coexist.) + + default configuration + Example of behaviour: + DROP DATABASE information_schema; + ERROR 42000: Access denied for user ... to database 'information_schema' + DROP DATABASE INFORMATION_SCHEMA; + ERROR 42000: Access denied for user ... to database 'INFORMATION_SCHEMA' -6. I am not sure of the files - ./funcs_1/include/create_.inc - are in the moment needed. I included them, because I - guess my VIEW testcase example needs them. - -I guess the pushed files are far away from being perfect. -It is a 8 hours hack. -Please try them, create missing files and come up with improvements. - -Good luck ! - -Matthias 17.06.2005 -=================================================================== -Omer 19.06.2005 ---------------- -1. Changed the structure of the memory_tb3 table to include two - additional column f121, f122. These columns exist for the table in - the other storage engines as TEXT. Since memory does not support - TEXT, Disha did not include them. How ever I am using them in the - Trigger tests so added them to the memory definition as CHAR(50);. - Also modifyed the DataGen_modiy.pl file to account for these two - column when generating the data. - - checked in a new DataGen_modify.pl (create a 'lib' directory - under 'funcs_1'). - - checked in a new memory_tb3.txt -2. Added three _triggers.test files based on Matthias's - structure above. -3. Added three __triggers.result files -4. Added the Trigger_master.test file in the trigger dierctory - Note: This is not complete and is still under work -5. Created a 'lib' directory and added the DataGen*.pl scripts to it - (exists under the disha suite) but should be here as well). -Omer 19.06.2005 -=================================================================== -Matthias 12.09.2005 -------------------- - Replace the geometry data types by VARBINARY - The removal of the geometry data types was necessary, because the - execution of the funcs_1 testsuite should not depend on the - availability of the geometry feature. - Note: There are servers compiled without the geometry feature. - - The columns are not removed, but their data type was changed - VARBINARY. This allows us to omit any changes within the loader - input files or data generation scripts. - The replacement of geometry by VARCHAR allows us to use our - -Matthias 12.09.2005 -=================================================================== -Matthias 14.09.2005 -------------------- - The results of the _views testcases suffer when - executed in "--ps-protocol" mode from the open - Bug#11589: mysqltest, --ps-protocol, strange output, - float/double/real with zerofill . - Implementation of a workaround: - At the beginning of views_master.inc is a variable $have_bug_11589 . - If this varable is set to 1, the ps-protocol will be switched - of for the critical statements. -Matthias 14.09.2005 -=================================================================== -Carsten 16.09.2005 ------------------- -1. The results of the datadict_ testcases have been changed in nearly - all occurrencies of --error because now for the INFORMATION_SCHEMA only - the --error 1044 (ERROR 42000: Access denied for user '..' to database - 'information_schema') seems to be used. -2. To get identical results when using "--ps-protocol" some SELECTs FROM - information_schema has been wrapped to suppress using ps-protocol because - there are differences. -3. The test using SELECT .. OUTFILE has been disabled due to bug #13202. -4. Fixed datadict_.result files after the change that added 2 columns to - the VIEWS table (DEFINER varchar(77), SECURITY_TYPE varchar(7)). -=================================================================== -Matthias 25.08.2007 -------------------- -Data dictionary tests: -Fixes for Bugs 30418,30420,30438,30440 -1. Replace error numbers with error names -2. Replace static "InnoDB" (not all time available) used within an - "alter table" by $OTHER_ENGINE_TYPE (set to MEMORY or MyISAM). - Minor adjustment of column data type. -3. Use mysqltest result set sorting in several cases. -4. Avoid any statistics about help tables, because their content - depends on configuration: - developer release - help tables are empty - build release - help tables have content + growing with version -5. Add two help table related tests (one for build, one for developer) - to ensure that informations about help tables within - INFORMATION_SCHEMA.TABLES/STATISTICS are checked. -6. Note about new Bug#30689 at the beginning of the test. - The files with expected results contain incomplete result sets. -7. Fix the NDB variant of the data dictionary test (ndb__datadict) as far as - it was necessary for the bug fixes mentioned above. - - -General note: - Most INFORMATION_SCHEMA properties (table layout, permissions etc.) - are not affected by our variation of the storage engines except - that some properties of our tables using a specific storage - engine become visible. So it makes sense to decompose - the data dictionary test into a storage engine specific part and - a non storage engine specific part in future. diff --git a/mysql-test/suite/funcs_1/datadict/basics_mixed1.inc b/mysql-test/suite/funcs_1/datadict/basics_mixed1.inc new file mode 100644 index 00000000000..2cb9cbc700b --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/basics_mixed1.inc @@ -0,0 +1,53 @@ +# suite/funcs_1/datadict/basics_mixed1.inc +# +# Auxiliary script to be sourced by suite/funcs_1/t/is_basics_mixed.test +# +# Author: +# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of +# testsuite funcs_1 +# Create this script based on older scripts and new code. +# + +# 1 Attempt to create tables and views when residing in information_schema +# 1.1 CREATE TABLE +USE information_schema; +let $message= root: create a table with a name of an IS table directly in IS; +let $dd_part1= CREATE TABLE; +let $dd_part2= ( c1 INT ); +--source suite/funcs_1/datadict/basics_mixed2.inc +# FIXME 3.2.1.6: error message ER_UNKNOWN_TABLE is misleading +--error ER_UNKNOWN_TABLE +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT); +# +# 1.2 CREATE VIEW +# 1.2.1 Hit on existing INFORMATION_SCHEMA table +--error ER_DBACCESS_DENIED_ERROR +CREATE VIEW tables AS SELECT 'garbage'; +--error ER_DBACCESS_DENIED_ERROR +CREATE VIEW tables AS SELECT * FROM information_schema.tables; +# 1.2.2 New view +# ER_DBACCESS_DENIED_ERROR would be better. +--error ER_UNKNOWN_TABLE +CREATE VIEW v1 AS SELECT 'garbage'; + +# 2 Attempt to create tables and views when residing in information_schema +# 1.1 CREATE TABLE +USE test; +let $message= root: create a table with a name of an IS table from other db; +let $dd_part1= CREATE TABLE information_schema.; +let $dd_part2= ( c1 INT ); +--source suite/funcs_1/datadict/basics_mixed2.inc +# FIXME 3.2.1.6: error message ER_UNKNOWN_TABLE is misleading +--error ER_UNKNOWN_TABLE +CREATE TABLE information_schema.t1 (f1 INT, f2 INT, f3 INT); +# +# Hit on existing INFORMATION_SCHEMA table +--error ER_DBACCESS_DENIED_ERROR +CREATE VIEW information_schema.tables AS SELECT 'garbage'; +--error ER_DBACCESS_DENIED_ERROR +CREATE VIEW information_schema.tables AS +SELECT * FROM information_schema.tables; +# New table +# ER_DBACCESS_DENIED_ERROR would be better. +--error ER_UNKNOWN_TABLE +CREATE VIEW information_schema.v1 AS SELECT 'garbage'; diff --git a/mysql-test/suite/funcs_1/datadict/basics_mixed2.inc b/mysql-test/suite/funcs_1/datadict/basics_mixed2.inc new file mode 100644 index 00000000000..6b1f07798fb --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/basics_mixed2.inc @@ -0,0 +1,55 @@ +#### suite/funcs_1/datadict/basics_mixed2.inc +# +# Auxiliary script to be sourced by suite/funcs_1/datadict/is_basics_mixed1.inc +# +# contains all tables from INFORMATION_SCHEMA +# +# Usage example(snip of script): +# let $dd_part1= CREATE TABLE information_schema.; +# let $dd_part2= ( c1 INT ); +# --source suite/funcs_1/datadict/basics_mixed2.inc +# +# We expect to get +# ERROR 42000: Access denied for user 'root'@'localhost' +# to database 'information_schema' +# for every statement. +# +# Author: +# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of +# testsuite funcs_1 +# Create this script based on older scripts and new code. +# + +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 schemata $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 tables $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 columns $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 character_sets $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 collations $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 collation_character_set_applicability $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 routines $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 statistics $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 views $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 user_privileges $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 schema_privileges $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 table_privileges $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 column_privileges $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 table_constraints $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 key_column_usage $dd_part2; +--error ER_DBACCESS_DENIED_ERROR +eval $dd_part1 triggers $dd_part2; + diff --git a/mysql-test/suite/funcs_1/datadict/basics_mixed3.inc b/mysql-test/suite/funcs_1/datadict/basics_mixed3.inc new file mode 100644 index 00000000000..f6a290636d9 --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/basics_mixed3.inc @@ -0,0 +1,42 @@ +#### suite/funcs_1/datadict/basics_mixed3.inc +# +# Auxiliary routine to be sourced by suite/funcs_1/t/is_basics_mixed.test +# +# Check if INFORMATION_SCHEMA tables contain a schema_name like 'db_data%'. +# +# Author: +# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of +# testsuite funcs_1 +# Create this script based on older scripts and new code. +# + +# No column with the name of a database contained in: +# character_sets collations collation_character_set_applicability +# user_privileges +SELECT DISTINCT table_schema FROM information_schema.columns +WHERE table_schema LIKE 'db_data%'; +SELECT DISTINCT table_schema FROM information_schema.column_privileges +WHERE table_schema LIKE 'db_data%'; +SELECT DISTINCT constraint_schema,table_schema +FROM information_schema.key_column_usage +WHERE constraint_schema LIKE 'db_data%' OR table_schema LIKE 'db_data%'; +SELECT DISTINCT routine_schema FROM information_schema.routines +WHERE routine_schema LIKE 'db_data%'; +SELECT DISTINCT schema_name FROM information_schema.schemata +WHERE schema_name LIKE 'db_data%'; +SELECT DISTINCT table_schema FROM information_schema.schema_privileges +WHERE table_schema LIKE 'db_data%'; +SELECT DISTINCT table_schema,index_schema FROM information_schema.statistics +WHERE table_schema LIKE 'db_data%' OR index_schema LIKE 'db_data%'; +SELECT DISTINCT table_schema FROM information_schema.tables +WHERE table_schema LIKE 'db_data%'; +SELECT DISTINCT constraint_schema,table_schema +FROM information_schema.table_constraints +WHERE constraint_schema LIKE 'db_data%' OR table_schema LIKE 'db_data%'; +SELECT DISTINCT table_schema FROM information_schema.table_privileges +WHERE table_schema LIKE 'db_data%'; +SELECT DISTINCT trigger_schema,event_object_schema +FROM information_schema.triggers +WHERE trigger_schema LIKE 'db_data%' OR event_object_schema LIKE 'db_data%'; +SELECT DISTINCT table_schema FROM information_schema.views +WHERE table_schema LIKE 'db_data%'; diff --git a/mysql-test/suite/funcs_1/datadict/charset_collation.inc b/mysql-test/suite/funcs_1/datadict/charset_collation.inc new file mode 100644 index 00000000000..f8fc58b082b --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/charset_collation.inc @@ -0,0 +1,122 @@ +# suite/funcs_1/datadict/charset_collation.inc +# +# Tests checking the content of the information_schema tables +# character_sets +# collations +# collation_character_set_applicability +# +# +# The amount and properties of character_sets/collations depend on the +# build type +# 2007-12 MySQL 5.0 +# --------------------------------------------------------------------- +# +# Variant 1 fits to +# version_comment MySQL Enterprise Server (Commercial) +# version_comment MySQL Enterprise Server (GPL) +# version_comment MySQL Classic Server (Commercial) +# version_comment MySQL Pushbuild Edition, build +# (version_comment Source distribution +# and +# compile was without "max" - > no collation 'utf8_general_ci') +# +# Variant 2 fits to +# version_comment MySQL Enterprise Server (GPL) +# version_comment MySQL Classic Server (Commercial) +# version_comment MySQL Pushbuild Edition, build +# (version_comment Source distribution +# and +# compile was without "max" - > collation 'utf8_general_ci' exists) +# +# Difference between variant 1 and 2 is the collation 'utf8_general_ci'. +# +# Variant 3 fits to +# version_comment MySQL Community Server (GPL) +# version_comment MySQL Cluster Server (Commercial) +# +# Difference between variant 3 and 2 is within the collation properties +# IS_COMPILED and SORTLEN. +# +# Created: +# 2007-12-18 mleich - remove the unstable character_set/collation subtests +# from include/datadict-master.inc +# - create this new test +# + +# Create a low privileged user. +--error 0, ER_CANNOT_USER +DROP USER dbdict_test@localhost; +CREATE USER dbdict_test@localhost; + +--echo # Establish connection con (user=dbdict_test) +--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK +connect (con,localhost,dbdict_test,,); +################################################################################ +# +# The original requirements for the following tests were: +# +# 3.2.2.2: Ensure that the table (information_schema.character_sets) shows the +# relevant information on every character set for which the current +# user or PUBLIC have the USAGE privilege. +# +# 3.2.2.3: Ensure that the table (information_schema.character_sets) does not +# show any information on any character set for which the current user +# or PUBLIC have no USAGE privilege. +# +# +# 3.2.3.2: Ensure that the table (information_schema.collations) shows the +# relevant information on every collation for which the current user +# or PUBLIC have the USAGE privilege. +# +# 3.2.3.3: Ensure that the table (information_schema.collations) does not show +# any information on any collations for which the current user and +# PUBLIC have no USAGE privilege. +# +# +# 3.2.4.2: Ensure that the table +# information_schema.collation_character_set_applicability +# shows the relevant information on every collation/character set +# combination for which the current user or PUBLIC have the USAGE +# privilege. +# +# 3.2.4.3: Ensure that the table +# information_schema.collation_character_set_applicability +# does not show any information on any collation/character set +# combinations for which the current user and PUBLIC have no +# USAGE privilege. +# +# Notes (2007-12-19 mleich): +# - The requirements are outdated because grant/revoke privilege for using a +# characterset/collation were never implemented. +# Therefore the tests should simply check the content of these tables. +# +# - The amount of collations/character sets grows with new MySQL releases. +# +# - Even within the same release the amount of records within these tables +# can differ between different build types (community, enterprise, source,...) +# +# +################################################################################ +--echo +SELECT * +FROM information_schema.character_sets +ORDER BY character_set_name; + +--echo +SELECT * +FROM information_schema.collations +ORDER BY collation_name; + +echo; +--echo +SELECT * +FROM information_schema.collation_character_set_applicability +ORDER BY collation_name, character_set_name; + + +# Cleanup +--echo # Switch to connection default + disconnect con +connection default; +disconnect con; +DROP USER dbdict_test@localhost; + diff --git a/mysql-test/suite/funcs_1/datadict/columns.inc b/mysql-test/suite/funcs_1/datadict/columns.inc new file mode 100644 index 00000000000..86f8afeff73 --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/columns.inc @@ -0,0 +1,87 @@ +# suite/funcs_1/datadict/is_columns.inc +# +# Auxiliary script to be sourced by +# is_columns_is +# is_columns_mysql +# is_columns_ +# +# Purpose: +# Check the content of information_schema.columns about tables within certain +# database/s. +# +# Usage: +# The variable $my_where has to +# - be set before sourcing this script. +# - contain the first part of the WHERE qualification +# Example: +# let $my_where = WHERE table_schema = 'information_schema' +# AND table_name <> 'profiling'; +# --source suite/funcs_1/datadict/is_columns.inc +# +# Author: +# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of +# testsuite funcs_1 +# Create this script based on older scripts and new code. +# + +--source suite/funcs_1/datadict/datadict_bug_12777.inc +eval +SELECT * FROM information_schema.columns +$my_where +ORDER BY table_schema, table_name, column_name; + +--echo ########################################################################## +--echo # Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH +--echo ########################################################################## +eval +SELECT DISTINCT + CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, + DATA_TYPE, + CHARACTER_SET_NAME, + COLLATION_NAME +FROM information_schema.columns +$my_where +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; + +#FIXME 3.2.6.2: check the value 2.0079 tinytext ucs2 ucs2_general_ci +eval +SELECT DISTINCT + CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, + DATA_TYPE, + CHARACTER_SET_NAME, + COLLATION_NAME +FROM information_schema.columns +$my_where +AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1 +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; + +eval +SELECT DISTINCT + CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, + DATA_TYPE, + CHARACTER_SET_NAME, + COLLATION_NAME +FROM information_schema.columns +$my_where + AND CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL +ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; + +echo --> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values; +echo --> are 0, which is intended behavior, and the result of 0 / 0 IS NULL; +--source suite/funcs_1/datadict/datadict_bug_12777.inc +eval +SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, + TABLE_SCHEMA, + TABLE_NAME, + COLUMN_NAME, + DATA_TYPE, + CHARACTER_MAXIMUM_LENGTH, + CHARACTER_OCTET_LENGTH, + CHARACTER_SET_NAME, + COLLATION_NAME, + COLUMN_TYPE +FROM information_schema.columns +$my_where +ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION; + diff --git a/mysql-test/suite/funcs_1/datadict/datadict.pre b/mysql-test/suite/funcs_1/datadict/datadict.pre new file mode 100644 index 00000000000..cedc24aad13 --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/datadict.pre @@ -0,0 +1,54 @@ +#### suite/funcs_1/datadict/datadict.pre +# +# Auxiliary script which loads prerequisites +# (variables needed for --replace_result ...) +# in datadictionary tests. +# +# Author: +# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of +# testsuite funcs_1 +# Create this script based on older scripts and new code. +# +--disable_query_log + +# Bug#12777 Different size shown for VARCHAR(n) columns (with n> 64) +# in INFORMATION_SCHEMA +# This bug was unfortunately (for testers) declared to be no bug. +# So CHARACTER_MAXIMUM_LENGTH of several _CATALOG columns within +# the INFORMATION_SCHEMA depends on PATH_MAX of the operating system. +# Workaround for this problem: +# Get the size of ONE known colum and check the size against some values to +# be able to use the correct --replace_result statement. Using this only the +# one pair of 'wrong' values is replaced and not all occurrencies of all +# possible pairs of values. See bug #12777 for details. +SELECT character_maximum_length INTO @CML +FROM information_schema.columns +WHERE table_schema = 'information_schema' + AND table_name = 'columns' + AND column_name = 'table_catalog'; + +let $bug_12777_0512= `SELECT @CML = 512`; +let $bug_12777_1023= `SELECT @CML = 1023`; +let $bug_12777_1024= `SELECT @CML = 1024`; +let $bug_12777_2048= `SELECT @CML = 2048`; +# 4096 is the value used in the files with expected results. +let $bug_12777_4095= `SELECT @CML = 4095`; +if (0) +{ + # enable this for debugging only, but NOT in a pushed version, as then the + # result changes from OS to OS ... + eval SELECT @CML AS 'CML', + $bug_12777_0512 AS '512', + $bug_12777_1023 AS '1023', + $bug_12777_1024 AS '1024', + $bug_12777_2048 AS '2048', + $bug_12777_4095 AS '4095'; +} + + +# Prepare a variable to be able to suppress machine dependant diffs +# this can be used in: --replace_result $SERVER_NAME +let $SERVER_NAME= `SELECT DISTINCT host FROM mysql.user + WHERE host NOT In ("localhost", "127.0.0.1", "%")`; +--enable_query_log + diff --git a/mysql-test/suite/funcs_1/datadict/datadict_load.inc b/mysql-test/suite/funcs_1/datadict/datadict_load.inc index 34792080ace..ab1211e9c9f 100644 --- a/mysql-test/suite/funcs_1/datadict/datadict_load.inc +++ b/mysql-test/suite/funcs_1/datadict/datadict_load.inc @@ -71,67 +71,51 @@ let $engine_ndb= `SELECT @ENGINE_NDB = 1`; # Note: The NDB variant with their own tb1 - tb4 tables is not ready for use. let $engine_ndb= 0; -# Decide, if the objects are to be (re)created -# -# - once at the beginning of a set of testcases ('$NO_REFRESH' <> '' --> TRUE) -# That means the current script must not (re)create any object. -# It can expect, that the objects already exist. -# -# - per every testscript/case ('$NO_REFRESH' = '' --> FALSE) -# That means all objects have to be (re)created within the current script. -# -eval SET @NO_REFRESH = IF( '$NO_REFRESH' = '', 0, 1); -let $run= `SELECT @NO_REFRESH = 0`; -if ($run) +--disable_warnings +DROP DATABASE IF EXISTS test1; +--enable_warnings +CREATE DATABASE test1; +USE test; + +if ($engine_innodb) { - --disable_warnings - DROP DATABASE IF EXISTS test1; - --enable_warnings - CREATE DATABASE test1; - USE test; - - # until a statement 'eval --source suite/funcs_1/include/$var_tb1.inc - # works we need to have similar statements for each $engine - if ($engine_innodb) - { - --source suite/funcs_1/include/innodb_tb1.inc - --source suite/funcs_1/include/innodb_tb2.inc - --source suite/funcs_1/include/innodb_tb3.inc - --source suite/funcs_1/include/innodb_tb4.inc - USE test1; - --source suite/funcs_1/include/innodb_tb2.inc - } - - if ($engine_memory) - { - --source suite/funcs_1/include/memory_tb1.inc - --source suite/funcs_1/include/memory_tb2.inc - --source suite/funcs_1/include/memory_tb3.inc - --source suite/funcs_1/include/memory_tb4.inc - USE test1; - --source suite/funcs_1/include/memory_tb2.inc - } - - if ($engine_myisam) - { - --source suite/funcs_1/include/myisam_tb1.inc - --source suite/funcs_1/include/myisam_tb2.inc - --source suite/funcs_1/include/myisam_tb3.inc - --source suite/funcs_1/include/myisam_tb4.inc - USE test1; - --source suite/funcs_1/include/myisam_tb2.inc - } - - if ($engine_ndb) - { - --source suite/funcs_1/include/ndb_tb1.inc - --source suite/funcs_1/include/ndb_tb2.inc - --source suite/funcs_1/include/ndb_tb3.inc - --source suite/funcs_1/include/ndb_tb4.inc - USE test1; - --source suite/funcs_1/include/ndb_tb2.inc - } - - USE test; - --source suite/funcs_1/include/sp_tb.inc + --source suite/funcs_1/include/innodb_tb1.inc + --source suite/funcs_1/include/innodb_tb2.inc + --source suite/funcs_1/include/innodb_tb3.inc + --source suite/funcs_1/include/innodb_tb4.inc + USE test1; + --source suite/funcs_1/include/innodb_tb2.inc } + +if ($engine_memory) +{ + --source suite/funcs_1/include/memory_tb1.inc + --source suite/funcs_1/include/memory_tb2.inc + --source suite/funcs_1/include/memory_tb3.inc + --source suite/funcs_1/include/memory_tb4.inc + USE test1; + --source suite/funcs_1/include/memory_tb2.inc +} + +if ($engine_myisam) +{ + --source suite/funcs_1/include/myisam_tb1.inc + --source suite/funcs_1/include/myisam_tb2.inc + --source suite/funcs_1/include/myisam_tb3.inc + --source suite/funcs_1/include/myisam_tb4.inc + USE test1; + --source suite/funcs_1/include/myisam_tb2.inc +} + +if ($engine_ndb) +{ + --source suite/funcs_1/include/ndb_tb1.inc + --source suite/funcs_1/include/ndb_tb2.inc + --source suite/funcs_1/include/ndb_tb3.inc + --source suite/funcs_1/include/ndb_tb4.inc + USE test1; + --source suite/funcs_1/include/ndb_tb2.inc +} + +USE test; +--source suite/funcs_1/include/sp_tb.inc diff --git a/mysql-test/suite/funcs_1/datadict/datadict_master.inc b/mysql-test/suite/funcs_1/datadict/datadict_master.inc deleted file mode 100644 index 73a23d6d377..00000000000 --- a/mysql-test/suite/funcs_1/datadict/datadict_master.inc +++ /dev/null @@ -1,3966 +0,0 @@ -#### suite/funcs_1/datadict/datadict_master.inc -# -# Checks of INFORMATION_SCHEMA table properties and content. -# (mostly only the features introduced with MySQL 5.1) -# -# Please set the variable $OTHER_ENGINE_TYPE before sourcing this script. -# $OTHER_ENGINE_TYPE must be -# - <> $engine_type -# - all time available like MyISAM or MEMORY -# -# Last change: -# 2007-08-24 mleich Fixes for the bugs -# #30438 "{memory,myisam,ndb}__datadict" tests fail: -# Use "InnoDB" without checking -# #30418 "datadict" tests (all engines) fail: -# Dependency on the host name for ordering -# #30420 "datadict" tests (all engines) fail: -# Release build has help tables loaded -# - ---disable_abort_on_error -let $message= -. -. It is intended that the 3 __datadict.test files are named this way to be -. sure they are - in a *full run* of the suite - the first tests done for each -. storage engine. Using two _ and the order of processing in mysql-test-run.pl -. ensures this in an easy way. -. -. If needed a restart could be implemented later between the storage engines if -. values changes in the result depending from the position where the -. *__datadict.test are started. This can be a result of showing e.g. maximum -. values of the number of rows of tables. -. -. This .result file has been checked OK with Linux 5.0.48, -. build tree ChangeSet@1.2477.6.3, 2007-07-30 -. except that the not fixed Bug#30020 causes a difference. -.; ---source include/show_msg80.inc - -################################################################################ -# - let $message= FIXME: There are subtests that are switched off due to known bugs:; - --source include/show_msg.inc - #set variable(s) here to be able to switch crashing sub tests with ONE change HERE. - #change the variable(s) to enable / disable the crashing parts. - - # different 'logics' are used because sometimes codelines needs to be switched off - # and otherwise some extra statements needs to be executed as long as the bug is not - # fixed: - let $have_bug_11589= 1; - let $have_bug_30689= 1; - - #seems not to work: --vertical_results - eval SELECT $have_bug_11589 AS "have_bug_11589"; - eval SELECT $have_bug_30689 AS "have_bug_30689"; - #seems not to work: --horizontal_results - - # As long as - # Bug#11589: mysqltest, --ps-protocol, strange output, float/double/real with zerofill - # is not fixed, we must switch the ps-protocol for some statements off. - # If this bug is fixed, please - # 1. set the following variable to 0 - # 2. check, if the test passes - # 3. remove the workarounds - if ($have_bug_11589) - { - let $message= There are some statements where the ps-protocol is switched off. - This may come from the bug listed below, ir from other problems. - Bug#11589: mysqltest, --ps-protocol, strange output, float/double/real with zerofill; - --source include/show_msg80.inc - } - if ($have_bug_30689) - { - let $message= Selects on INFORMATION_SCHEMA.VIEWS present incomplete - content for the column VIEW_DEFINITION in cases where - the view selects(=is based) on an INFORMATION_SCHEMA table. - ---> VIEWS vu and vu1 - Bug#30689 Wrong content in I_S.VIEWS.VIEW_DEFINITION if VIEW is based on I_S; - --source include/show_msg80.inc - } -# -################################################################################ - - -# loading the tables (data is not really needed in this test) is separated to -# make it easier in this file to show the message above. ---source suite/funcs_1/datadict/datadict_load.inc - -#FIXME: - check for remaining change of object names to standards: db_, tb_, v_, u_, ... -#FIXME: - check warnings when data is loaded (Data truncated for column ...) -#FIXME: - change connect() to use less users / connections -# -#FIXME: - check for additional 'FIXME' here in the script - -use information_schema; ---source suite/funcs_1/include/show_connection.inc - - -################################################################################ -# -# Data Dictionary -# -################################################################################ - -let $message= Testcase 3.2.1.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.1: Ensure that every INFORMATION_SCHEMA table can be queried -# with a SELECT statement, just as if it were an ordinary -# user-defined table. -################################################################################ - -# create at least one object for all 'tables' to be checked ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings -CREATE DATABASE db_datadict; -USE db_datadict; - -CREATE VIEW v1 AS SELECT * FROM information_schema.tables; - -# try to get the server's name to be able to clean-up the result from machine -# specific stuff. -CREATE OR REPLACE VIEW db_datadict.vu1 as -SELECT grantee AS u - FROM information_schema.user_privileges; -CREATE OR REPLACE VIEW db_datadict.vu as -SELECT DISTINCT u, - SUBSTRING( u, LENGTH(SUBSTRING_INDEX(u,_utf8'@',1))+3 ) - AS server, - SUBSTRING( u, LENGTH(SUBSTRING_INDEX(u,_utf8'@',1))+3, - LENGTH( SUBSTRING( u, - LENGTH( SUBSTRING_INDEX(u, _utf8'@',1)) +3 )) - 1 ) - AS Server_Clean -FROM db_datadict.vu1; ---replace_result $SERVER_NAME ---sorted_result -SELECT * FROM db_datadict.vu order by u; - -delimiter //; -CREATE PROCEDURE db_datadict.sp_1() - BEGIN - SELECT * FROM db_datadict.v1; - END// -delimiter ;// - -#FIXME 3.2.1.1: add missing objects of each type to have something to select -#FIXME 3.2.1.1: - FUNCTION -#FIXME 3.2.1.1: - TRIGGER - -USE information_schema; -SHOW tables; - -select * from schemata ORDER BY 2 DESC, 1 ASC; - -if ($have_bug_11589) -{ ---disable_ps_protocol -} ---vertical_results -#SELECT * FROM tables; -# -#FIXME 3.2.1.1: we split the "SELECT * FROM tables" in two parts until -#FIXME 3.2.1.1: Bug #12397: wrong values shown in column CREATE_OPTIONS of -#FIXME 3.2.1.1: INFORMATION_SCHEMA.TABLES is solved, one with 'more' and one -#FIXME 3.2.1.1: with 'less' replace -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -# 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 17 CHECK_TIME -# 20 CREATE_OPTIONS ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" 20 "#CO#" -SELECT * FROM tables - WHERE table_schema = 'information_schema'; -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -# 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 17 CHECK_TIME ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -SELECT * FROM tables -WHERE NOT( table_schema = 'information_schema') - AND NOT (table_schema = 'mysql' AND table_name LIKE 'help_%'); ---horizontal_results ---enable_ps_protocol - -select s.catalog_name, s.schema_name, s.default_character_set_name, - t.table_type, t.engine - from schemata s inner join tables t - ORDER BY s.schema_name, s.default_character_set_name, table_type, engine; ---source suite/funcs_1/datadict/datadict_bug_12777.inc -select * from columns; -select * from character_sets; -select sum(id) from collations where collation_name <> 'utf8_general_cs'; -select collation_name, character_set_name into @x,@y - from collation_character_set_applicability limit 1; - select @x, @y; - ---replace_column 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -select * from routines; - -select count(*) from routines; -select * from statistics -where not (table_schema = 'mysql' and table_name like 'help_%'); -select * from views; ---replace_result $SERVER_NAME ---sorted_result -select * from user_privileges order by grantee, privilege_type; -select * from schema_privileges; -select * from table_privileges; -select * from column_privileges; -select * from table_constraints; -select * from key_column_usage; -select count(*) as max_recs from key_column_usage; - -select max(cardinality) from statistics -where not (table_schema = 'mysql' and table_name like 'help_%'); - -select concat("View '", - table_name, "' is associated with the database '", table_schema, "'.") - AS "Who is Who for the Views" - from views; - -select concat("Table or view '", table_name, - "' is associated with the database '", table_schema, "'.") as "Who is Who" - from tables; - ---replace_result $SERVER_NAME ---sorted_result -select grantee as "user's having select privilege", - substring( grantee, length(SUBSTRING_INDEX(grantee,_utf8'@',1))+2 ) - from user_privileges where privilege_type = 'select' - order by grantee; - -select all table_schema from schema_privileges limit 0,5; - -select distinct(privilege_type) from table_privileges; - -select * from column_privileges - group by table_schema having table_schema = 'db_datadict'; - -select * from table_constraints limit 0,5; -select count(*) as max_recs from key_column_usage limit 0,5; - -select information_schema.tables.table_name as "table name", - count(distinct(column_name)) as "no of columns in the table" - from information_schema.tables left outer join information_schema.columns on - information_schema.tables.table_name = information_schema.columns.table_name - group by information_schema.tables.table_name; - -# Reference Manual 22.1.16 - we will add more ...: -# select * from parameters; -# select * from referential_constraints; -# select * from triggers; - -let $message= root: simple select to check all - and never forget some - tables; -let $dd_part1= SELECT * FROM; -let $dd_part2= LIMIT 1; ---source suite/funcs_1/datadict/datadict_tables.inc - -# check again, but from different database (will fail due to missing database name) -use db_datadict; - ---error ER_NO_SUCH_TABLE -select * from schemata; ---error ER_NO_SUCH_TABLE -select * from tables; ---error ER_NO_SUCH_TABLE -select s.catalog_name, s.schema_name, s.default_character_set_name, - t.table_type, t.engine - from schemata s inner join tables t - ORDER BY s.catalog_name, s.schema_name, s.default_character_set_name; ---error ER_NO_SUCH_TABLE -select * from columns limit 0, 5; ---error ER_NO_SUCH_TABLE -select * from character_sets limit 0, 5; ---error ER_NO_SUCH_TABLE -select * from collations limit 0, 5; ---error ER_NO_SUCH_TABLE -select * from collation_character_set_applicability limit 0, 5; ---error ER_NO_SUCH_TABLE -select * from routines limit 0, 5; ---error ER_NO_SUCH_TABLE -select * from statistics limit 0, 5; ---error ER_NO_SUCH_TABLE -select * from views limit 0, 5; ---error ER_NO_SUCH_TABLE -select * from user_privileges limit 0, 5; ---error ER_NO_SUCH_TABLE -select * from schema_privileges limit 0, 5; ---error ER_NO_SUCH_TABLE -select * from table_privileges limit 0, 5; ---error ER_NO_SUCH_TABLE -select * from column_privileges limit 0, 5; ---error ER_NO_SUCH_TABLE -select * from table_constraints limit 0, 5; ---error ER_NO_SUCH_TABLE -select * from key_column_usage limit 0, 5; -# Reference Manual 22.1.16 - we will add more ...: -# --error ER_NO_SUCH_TABLE -# select * from parameters; -# --error ER_NO_SUCH_TABLE -# select * from referential_constraints; -# --error ER_NO_SUCH_TABLE -# select * from triggers; -let $message= will fail due to missing database name; -let $dd_part1= SELECT * FROM; -let $dd_part2=; ---source suite/funcs_1/datadict/datadict_tables_error_1146.inc - -# now check from "other" database, but with database name -select * from information_schema.schemata ORDER BY 2 DESC; - -#SELECT * FROM information_schema.tables; -# -#FIXME 3.2.1.1: we split the "SELECT * FROM tables" in two parts until -#FIXME 3.2.1.1: Bug #12397: wrong values shown in column CREATE_OPTIONS of -#FIXME 3.2.1.1: INFORMATION_SCHEMA.TABLES is solved, one with 'more' and one -#FIXME 3.2.1.1: with 'less' replace -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -# 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 17 CHRCK_TIME -# 20 CREATE_OPTIONS -if ($have_bug_11589) -{ ---disable_ps_protocol -} ---vertical_results ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" 20 "#CO#" -SELECT * FROM information_schema.tables - WHERE table_schema = 'information_schema'; -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -# 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 17 CHRCK_TIME ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -SELECT * FROM information_schema.tables -WHERE NOT( table_schema = 'information_schema') - AND NOT (table_schema = 'mysql' AND table_name LIKE 'help_%'); ---horizontal_results ---enable_ps_protocol - -select s.catalog_name, s.schema_name, s.default_character_set_name, - t.table_type, t.engine - from information_schema.schemata s inner join information_schema.tables t - ORDER BY s.schema_name, s.default_character_set_name, table_type, engine; - ---source suite/funcs_1/datadict/datadict_bug_12777.inc -select * from information_schema.columns limit 0, 5; -select * from information_schema.character_sets limit 0, 5; -select * from information_schema.collations limit 0, 5; -select * from information_schema.collation_character_set_applicability limit 0, 5; ---replace_column 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -select * from information_schema.routines limit 0, 5; -select * from information_schema.statistics limit 0, 5; -select * from information_schema.views limit 0, 5; ---replace_result $SERVER_NAME -select * from information_schema.user_privileges limit 0, 5; -select * from information_schema.schema_privileges limit 0, 5; -select * from information_schema.table_privileges limit 0, 5; -select * from information_schema.column_privileges limit 0, 5; -select * from information_schema.table_constraints limit 0, 5; -select * from information_schema.key_column_usage limit 0, 5; -select count(*) as max_recs from information_schema.key_column_usage limit 0, 5; - -# Reference Manual 22.1.16 - we will add more ...: -# select * from information_schema.parameters; -# select * from information_schema.referential_constraints; -# select * from information_schema.triggers; - -let $message= root: check with db name; -let $dd_part1= SELECT COUNT(*) FROM information_schema.; -let $dd_part2=; ---source suite/funcs_1/datadict/datadict_tables.inc - -# cleanup -USE db_datadict; -DROP VIEW v1, vu1, vu; -DROP PROCEDURE db_datadict.sp_1; -USE information_schema; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.2:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.2: Ensure that queries on an INFORMATION_SCHEMA table can -# accept all SELECT statement options and are always -# correctly evaluated. -################################################################################ - -# currently here only a subset of select statement options is checked, it's still -# not possible to check here all possible options -select catalog_name, schema_name, default_character_set_name - from schemata where schema_name like '%s%'; - -select count(*) as tot_tabs from tables; -select count(*) as the_cols from columns; - -select max(maxlen) as the_max from character_sets; -select * from collations order by id asc limit 0, 5; -select * from collation_character_set_applicability - order by character_set_name desc, collation_name limit 0, 5; - -select routine_definition from routines; -select * from statistics where table_name not like 'help_%' -group by index_name asc limit 0, 5; -select concat(table_schema, ', ', table_name, ', ', view_definition) view_info - from views; -select concat(table_schema, ', ', table_name) "Table_info" - from tables ORDER BY 1; - ---replace_result $SERVER_NAME ---sorted_result -select distinct grantee from user_privileges order by grantee, privilege_type; -select * from schema_privileges where table_catalog is null limit 0, 5; -select * from table_privileges where grantee like '%r%' limit 0, 5; - -select * from column_privileges where table_catalog is not null limit 0, 5; -select HIGH_PRIORITY * from table_constraints - group by constraint_name desc limit 0, 5; -select sum(ordinal_position) from key_column_usage; - -select * from schemata limit 0,5; -select * from schemata limit 0,5; ---replace_result $SERVER_NAME ---sorted_result -select distinct grantee from user_privileges; ---replace_result $SERVER_NAME ---sorted_result -select all grantee from user_privileges order by grantee, privilege_type; - -select id , character_set_name from collations order by id asc limit 10; - -select table_catalog from columns - union all -select table_catalog from tables limit 0,5; -select table_catalog from columns - union -select table_catalog from tables limit 0,5; - -select all schema_name from information_schema.schemata; - -# the $ENGINE_TYPE variable is used here ONLY to have 3 different file names in -# the three datadict testcases innodb_*, memory_* and myisam_* -eval SELECT * - INTO OUTFILE '../tmp/out.$ENGINE_TYPE.file' - FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' - LINES TERMINATED BY '\n' - FROM schemata LIMIT 0, 5; - -USE test; - -eval SELECT * - INTO OUTFILE '../tmp/out.$ENGINE_TYPE.db.file' - FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' - LINES TERMINATED BY '\n' - FROM information_schema.schemata - WHERE schema_name LIKE 'db_%'; - -# check also with a 'simple' user -CREATE USER user_3212@localhost; -GRANT ALL ON db_datadict.* TO user_3212@localhost; -# OBN: The following line was added following the fix to bug 28181 -# where queries to information_schema will fail if exporting to -# a file without having the FILE attribute -GRANT FILE ON *.* TO user_3212@localhost; - - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u3212,localhost,user_3212,,db_datadict); ---source suite/funcs_1/include/show_connection.inc - -# no db given --> db_datadict.schema does not exist ---error ER_NO_SUCH_TABLE -eval SELECT * - INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user.file' - FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' - LINES TERMINATED BY '\n' - FROM schemata LIMIT 0, 5; ---error ER_NO_SUCH_TABLE -eval SELECT * - FROM schemata LIMIT 0, 5; - -eval SELECT * - INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user.db.file' - FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' - LINES TERMINATED BY '\n' - FROM information_schema.schemata - WHERE schema_name LIKE 'db_%'; - -eval SELECT * - FROM information_schema.schemata - WHERE schema_name LIKE 'db_%'; - -USE information_schema; - -eval SELECT * - INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user_2.file' - FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' - LINES TERMINATED BY '\n' - FROM schemata LIMIT 0, 5; - -eval SELECT * - FROM schemata LIMIT 0, 5; - -eval SELECT * - INTO OUTFILE '../tmp/out.$ENGINE_TYPE.user_2.db.file' - FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' - LINES TERMINATED BY '\n' - FROM information_schema.schemata - WHERE schema_name LIKE 'db_%'; - -eval SELECT * - FROM information_schema.schemata - WHERE schema_name LIKE 'db_%'; - -disconnect u3212; -connection default; -USE information_schema; ---source suite/funcs_1/include/show_connection.inc - -use db_datadict; -select table_catalog "1", table_schema "2", table_name "3", column_name "4" - from information_schema.columns -union -select table_catalog, table_schema, table_name, - concat( "*** type = ", table_type ) - from information_schema.tables - order by 3, 4 desc, 1, 2 limit 30; - -use information_schema; ---source suite/funcs_1/datadict/datadict_bug_12777.inc -select table_catalog "1", table_schema "2", table_name "3", column_name "4" - from columns -union -select table_catalog, table_schema, table_name, - concat( "*** type = ", table_type ) - from tables - order by 3, 4 desc, 1, 2 limit 30; - -# cleanup -DROP USER user_3212@localhost; - -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.3:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.3: Ensure that no user may execute an INSERT statement on any -# INFORMATION_SCHEMA table. -################################################################################ - -#FIXME: in this block we had --error 1288 until Mid Sep05, check the change! ---error ER_DBACCESS_DENIED_ERROR -insert into schemata (catalog_name, schema_name, default_character_set_name, sql_path) - values ('null', 'db1', 'latin1', 'null'); ---error ER_DBACCESS_DENIED_ERROR -insert into tables (table_schema, table_name)values('db_datadict', 't1'); ---error ER_DBACCESS_DENIED_ERROR -insert into columns (table_name, column_name)values('t3', 'f2'); ---error ER_DBACCESS_DENIED_ERROR -insert into character_sets (character_set_name, default_collate_name, description, maxlen) - values('cp1251', 'cp1251_general_ci', 'windows cyrillic', 1); ---error ER_DBACCESS_DENIED_ERROR -insert into collations ( collation_name, character_set_name, id, is_default, is_compiled, sortlen) - values ('cp1251_bin', 'cp1251', 50, '', '', 0); ---error ER_DBACCESS_DENIED_ERROR -insert into collation_character_set_applicability (collation_name, character_set_name) - values (' big5_chinese_ci', 'big6'); ---error ER_DBACCESS_DENIED_ERROR -insert into routines(routine_name, routine_type ) values ('p2', 'procedure'); ---error ER_DBACCESS_DENIED_ERROR -insert into statistics(table_schema, table_name, index_name) - values ('mysql', 'db', 'primary'); ---error ER_DBACCESS_DENIED_ERROR -insert into views(table_schema, table_name) values ('db2', 'v2'); ---error ER_DBACCESS_DENIED_ERROR -insert into user_privileges (privilege_type, is_grantable) values ('select', 'yes'); ---error ER_DBACCESS_DENIED_ERROR -insert into schema_privileges (table_schema, privilege_type) values('db2', 'insert'); ---error ER_DBACCESS_DENIED_ERROR -insert into table_privileges (able_schema, table_name, privilege_type) - values('db2', 'v2', 'insert'); ---error ER_DBACCESS_DENIED_ERROR -insert into column_privileges (table_name, column_name, privilege_type) - values ('t3', 'f3', 'insert'); ---error ER_DBACCESS_DENIED_ERROR -insert into table_constraints ( constraint_schema, constraint_name, table_schema) - values ('primary', 'mysql', 'user'); ---error ER_DBACCESS_DENIED_ERROR -insert into key_column_usage (constraint_schema, constraint_name, table_name) - values ('mysql', 'primary', 'db'); - -# insert through a procedure ---disable_warnings -drop procedure if exists db_datadict.sp_4_1_3; ---enable_warnings - -delimiter //; -create procedure db_datadict.sp_4_1_3() -begin - insert into information_schema.schema_privileges (table_schema,privilege_type) - values('db2','insert'); -end// -delimiter ;// - -#FIXME: check for the diffs Win ./. Linux -SELECT table_schema, privilege_type FROM information_schema.schema_privileges - WHERE table_schema LIKE 'db%'; - ---error ER_DBACCESS_DENIED_ERROR -call db_datadict.sp_4_1_3(); - -#FIXME: check for the diffs Win ./. Linux -SELECT table_schema, privilege_type FROM information_schema.schema_privileges - WHERE table_schema LIKE 'db%'; - -# cleanup -drop procedure db_datadict.sp_4_1_3; - -# insert into information_schema as a limited user - -CREATE USER user_4_1_3@localhost; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u413,localhost,user_4_1_3,,test); ---source suite/funcs_1/include/show_connection.inc - -use information_schema; - -#FIXME: check later the change from 1288 to 1044 (since Mid Sep05) ---error ER_DBACCESS_DENIED_ERROR -insert into table_constraints ( constraint_schema, constraint_name, table_schema) - values ('primary', 'mysql', 'user'); - -connection default; ---source suite/funcs_1/include/show_connection.inc -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.4:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.4: Ensure that no user may execute an UPDATE statement on any -# INFORMATION_SCHEMA table. -################################################################################ - -use information_schema; ---source suite/funcs_1/include/show_connection.inc - -#FIXME: check later the change from 1288 to 1044 (since Mid Sep05) in the whole next block ---error ER_DBACCESS_DENIED_ERROR -update schemata set schema_name = 'db5' where default_character_set_name = 'latin1'; ---error ER_DBACCESS_DENIED_ERROR -update tables set table_schema = 'db_datadict1' where table_name = 't1'; ---error ER_DBACCESS_DENIED_ERROR -update columns set table_name = 't4' where column_name = 'f2'; ---error ER_DBACCESS_DENIED_ERROR -update character_sets set character_set_name = 'cp1252' where maxlen = 1; ---error ER_DBACCESS_DENIED_ERROR -update collations set collation_name = 'cp1253_bin' - where character_set_name = 'cp1251'; ---error ER_DBACCESS_DENIED_ERROR -update collation_character_set_applicability set collation_name = 'big6_chinese_ci' - where character_set_name = 'big6'; ---error ER_DBACCESS_DENIED_ERROR -update routines set routine_name = p2 where routine_body = 'sql'; ---error ER_DBACCESS_DENIED_ERROR -update statistics set table_schema = 'mysql1' where table_name = 'db'; ---error ER_DBACCESS_DENIED_ERROR -update views set table_schema = 'db3' where table_name = 'v1'; ---error ER_DBACCESS_DENIED_ERROR -update user_privileges set privilege_type = 'insert' where is_grantable = 'yes'; ---error ER_DBACCESS_DENIED_ERROR -update schema_privileges set table_schema = 'db2' where privilege_type = 'select'; ---error ER_DBACCESS_DENIED_ERROR -update table_privileges set table_name = 'v3' where privilege_type = 'select'; ---error ER_DBACCESS_DENIED_ERROR -update column_privileges set table_name = 't4' where column_name = 'f3'; ---error ER_DBACCESS_DENIED_ERROR -update table_constraints set constraint_schema = 'primary' - where table_schema = 'proc'; ---error ER_DBACCESS_DENIED_ERROR -update key_column_usage set table_name = 'db1' where constraint_name = 'primary'; - -# update through a procedure ---disable_warnings -drop procedure if exists db_datadict.sp_4_1_4; ---enable_warnings - -delimiter //; -create procedure db_datadict.sp_4_1_4() -begin - update information_schema.routines set routine_name = 'p2' - where routine_name = 'sp_4_1_4'; -end// -delimiter ;// - -#FIXME: check for the diffs Win ./. Linux ---replace_column 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -select * from information_schema.routines; - ---error ER_DBACCESS_DENIED_ERROR -call db_datadict.sp_4_1_4(); - -#FIXME: check for the diffs Win ./. Linux ---replace_column 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -select * from information_schema.routines; - -# cleanup -drop procedure db_datadict.sp_4_1_4; - -# update information_schema as a limited user - -connection u413; - -use information_schema; ---source suite/funcs_1/include/show_connection.inc - -#FIXME: check later the change from 1288 to 1044 (since Mid Sep05) ---error ER_DBACCESS_DENIED_ERROR -update user_privileges set privilege_type = 'insert' where is_grantable = 'yes'; - -connection default; ---source suite/funcs_1/include/show_connection.inc -# -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.5:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.5: Ensure that no user may execute a DELETE statement on any -# INFORMATION_SCHEMA table. -################################################################################ - -use information_schema; - -let $message= root: DELETE FROM any table in IS; -let $dd_part1= DELETE FROM; -let $dd_part2=; ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc - -#FIXME: check later the change from 1288 to 1044 (since Mid Sep05) in the whole next block ---error ER_DBACCESS_DENIED_ERROR -delete from schemata where schema_name = 'mysql'; ---error ER_DBACCESS_DENIED_ERROR -delete from tables where table_name = 'abc'; ---error ER_DBACCESS_DENIED_ERROR -delete from columns; ---error ER_DBACCESS_DENIED_ERROR -delete from character_sets; ---error ER_DBACCESS_DENIED_ERROR -delete from collations; ---error ER_DBACCESS_DENIED_ERROR -delete from collation_character_set_applicability; ---error ER_DBACCESS_DENIED_ERROR -delete from routines; ---error ER_DBACCESS_DENIED_ERROR -delete from statistics; ---error ER_DBACCESS_DENIED_ERROR -delete from views; ---error ER_DBACCESS_DENIED_ERROR -delete from user_privileges; ---error ER_DBACCESS_DENIED_ERROR -delete from schema_privileges; ---error ER_DBACCESS_DENIED_ERROR -delete from table_privileges; ---error ER_DBACCESS_DENIED_ERROR -delete from column_privileges; ---error ER_DBACCESS_DENIED_ERROR -delete from table_constraints; ---error ER_DBACCESS_DENIED_ERROR -delete from key_column_usage; - -# delete through a procedure ---disable_warnings -drop procedure if exists db_datadict.sp_4_1_5; ---enable_warnings - -delimiter //; -create procedure db_datadict.sp_4_1_5() -begin - delete from information_schema.column_privileges; -end// -delimiter ;// - ---error ER_DBACCESS_DENIED_ERROR -call db_datadict.sp_4_1_5(); - -# cleanup -drop procedure db_datadict.sp_4_1_5; - -# delete from information_schema as a limited user - -connection u413; - -use information_schema; ---source suite/funcs_1/include/show_connection.inc - -#FIXME: check later the change from 1288 to 1044 (since Mid Sep05) ---error ER_DBACCESS_DENIED_ERROR -delete from tables where table_name = 'abc'; - -disconnect u413; - -connection default; ---source suite/funcs_1/include/show_connection.inc - -# cleanup -DROP USER user_4_1_3@localhost; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.6:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.6: Ensure that no user may create an INFORMATION_SCHEMA base -# table. -################################################################################ - -use information_schema; - -let $message= root: create a table with a name of an IS table directly in IS; -let $dd_part1= CREATE TABLE; -let $dd_part2= ( c1 INT ); ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -#FIXME solved - 3.2.1.6: check for better error message - 42S02: Unknown table '' in ? ---error ER_UNKNOWN_TABLE -create table t1 (f1 int, f2 int, f3 int); - -use db_datadict; - -#FIXME: check correct error message - HY000 Can't create/write to file '.\information_schema\columns.frm' (Errcode: 2) -let $message= root: create a table with a name of an IS table from other db; -let $dd_part1= CREATE TABLE information_schema.; -let $dd_part2= ( c1 INT ); ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -#FIXME solved - 3.2.1.6: check for better error message - 42S02: Unknown table '' in ? ---error ER_UNKNOWN_TABLE -create table information_schema.t1 (f1 int, f2 int, f3 int); - -# create a table in information_schema as a limited user with sufficient permissions -CREATE USER user_4_1_6@localhost; - -grant all on *.* to user_4_1_6@localhost; - -FLUSH PRIVILEGES; - -SHOW GRANTS FOR user_4_1_6@localhost; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u2, localhost, user_4_1_6, , information_schema); ---source suite/funcs_1/include/show_connection.inc - -use information_schema; - -let $message= user: create a table with a name of an IS table directly in IS; -let $dd_part1= CREATE TABLE; -let $dd_part2= ( c1 INT ); ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -#FIXME solved - 3.2.1.6: check for better error message - 42S02: Unknown table '' in ? ---error ER_UNKNOWN_TABLE -create table t1 (f1 int, f2 int, f3 int); - -use test; - -#FIXME 3.2.1.6: check correct error message - HY000 Can't create/write to file '.\information_schema\columns.frm' (Errcode: 2) -let $message= user: create a table with a name of an IS table from other db; -let $dd_part1= CREATE TABLE information_schema.; -let $dd_part2= ( c1 INT ); ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -#FIXME solved - 3.2.1.6: check for better error message - 42S02: Unknown table '' in ? ---error ER_UNKNOWN_TABLE -create table information_schema.t1 (f1 int, f2 int, f3 int); - -#cleanup -connection default; ---source suite/funcs_1/include/show_connection.inc -disconnect u2; -DROP USER user_4_1_6@localhost; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.7:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.7: Ensure that no user may create an INFORMATION_SCHEMA view. -################################################################################ - -use information_schema; - -let $message= root: create a view with a name of an IS table directly in IS; -let $dd_part1= CREATE VIEW ; -let $dd_part2= AS SELECT * FROM mysql.time_zone; -#FIXME: check change from error 1 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc - ---error ER_UNKNOWN_TABLE -CREATE VIEW v1 AS SELECT * FROM information_schema.schemata; - -USE db_datadict; - -let $message= root: create a view with a name of an IS table from other db; -let $dd_part1= CREATE VIEW information_schema.; -let $dd_part2= AS SELECT * FROM mysql.time_zone; -#FIXME: check change from error 1 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc - -# ... but creating a view that 'uses' the information_schema is allowed: -CREATE VIEW v1 AS SELECT * FROM information_schema.columns; - -SELECT * FROM v1 LIMIT 5; - -# create a view in information_schema as a limited user with sufficient permissions -CREATE USER user_4_1_7@localhost; - -GRANT ALL ON db_datadict.* TO user_4_1_7@localhost; -#FIXME: check that GRANT ON i_s is no longer allowed ---error ER_DBACCESS_DENIED_ERROR -GRANT ALL ON information_schema.* TO user_4_1_7@localhost; - -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u3, localhost, user_4_1_7, , db_datadict); -use information_schema; ---source suite/funcs_1/include/show_connection.inc - -let $message= user: create a view with a name of an IS table directly in IS; -let $dd_part1= CREATE VIEW ; -let $dd_part2= AS SELECT * FROM db_datadict.v1; -#FIXME: check change from error 1 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc ---error ER_UNKNOWN_TABLE -create view v1 as select * from table_privileges; - -use db_datadict; - -let $message= user: create a view with a name of an IS table from other db; -let $dd_part1= CREATE VIEW information_schema.; -let $dd_part2= AS SELECT * FROM db_datadict.v1; -#FIXME: check change from error 1 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -disconnect u3; - -# cleanup -connection default; ---source suite/funcs_1/include/show_connection.inc -DROP USER user_4_1_7@localhost; -DROP VIEW db_datadict.v1; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.8:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.8: Ensure that no user may create an index on an -# INFORMATION_SCHEMA table. -################################################################################ - -use information_schema; - -#FIXME: check later the change from 1288 to 1044 (since Mid Sep05) ---error ER_DBACCESS_DENIED_ERROR -create index i1 on schemata(schema_name); ---error ER_DBACCESS_DENIED_ERROR -create index i2 on tables(table_schema); ---error ER_DBACCESS_DENIED_ERROR -create index i3 on columns(table_name); - ---error ER_DBACCESS_DENIED_ERROR -create index i4 on character_sets(character_set_name); ---error ER_DBACCESS_DENIED_ERROR -create index i5 on collations( collation_name); ---error ER_DBACCESS_DENIED_ERROR -create index i6 on collation_character_set_applicability(collation_name); - ---error ER_DBACCESS_DENIED_ERROR -create index i7 on routines(routine_name); ---error ER_DBACCESS_DENIED_ERROR -create index i8 on statistics(table_schema); ---error ER_DBACCESS_DENIED_ERROR -create index i9 on views(table_schema); - ---error ER_DBACCESS_DENIED_ERROR -create index i10 on user_privileges(privilege_type); ---error ER_DBACCESS_DENIED_ERROR -create index i11 on schema_privileges(table_schema); ---error ER_DBACCESS_DENIED_ERROR -create index i12 on table_privileges(able_schema); - ---error ER_DBACCESS_DENIED_ERROR -create index i13 on column_privileges(table_name); ---error ER_DBACCESS_DENIED_ERROR -create index i14 on table_constraints(constraint_schema); ---error ER_DBACCESS_DENIED_ERROR -create index i15 on key_column_usage(constraint_schema); ---error ER_DBACCESS_DENIED_ERROR -create index i16 on triggers(trigger_name); - -use db_datadict; ---error ER_DBACCESS_DENIED_ERROR -create index i15 on information_schema.key_column_usage(constraint_schema); - -use information_schema; - -# create an index on an information_schema table as a limited user with sufficient permissions -CREATE USER user_4_1_8@localhost; - -grant select, index on *.* to user_4_1_8@localhost; - -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u4, localhost, user_4_1_8, , test); ---source suite/funcs_1/include/show_connection.inc - -use information_schema; - ---error ER_DBACCESS_DENIED_ERROR -create index i1 on schemata(schema_name); ---error ER_DBACCESS_DENIED_ERROR -create index i2 on tables(table_schema); ---error ER_DBACCESS_DENIED_ERROR -create index i3 on columns(table_name); - ---error ER_DBACCESS_DENIED_ERROR -create index i4 on character_sets(character_set_name); ---error ER_DBACCESS_DENIED_ERROR -create index i5 on collations( collation_name); ---error ER_DBACCESS_DENIED_ERROR -create index i6 on collation_character_set_applicability(collation_name); - ---error ER_DBACCESS_DENIED_ERROR -create index i7 on routines(routine_name); ---error ER_DBACCESS_DENIED_ERROR -create index i8 on statistics(table_schema); ---error ER_DBACCESS_DENIED_ERROR -create index i9 on views(table_schema); - ---error ER_DBACCESS_DENIED_ERROR -create index i10 on user_privileges(privilege_type); ---error ER_DBACCESS_DENIED_ERROR -create index i11 on schema_privileges(table_schema); ---error ER_DBACCESS_DENIED_ERROR -create index i12 on table_privileges(able_schema); - ---error ER_DBACCESS_DENIED_ERROR -create index i13 on column_privileges(table_name); ---error ER_DBACCESS_DENIED_ERROR -create index i14 on table_constraints(constraint_schema); ---error ER_DBACCESS_DENIED_ERROR -create index i15 on key_column_usage(constraint_schema); ---error ER_DBACCESS_DENIED_ERROR -create index i16 on triggers(trigger_name); - -use db_datadict; ---error ER_DBACCESS_DENIED_ERROR -create index i15 on information_schema.key_column_usage(constraint_schema); - -disconnect u4; - -connection default; ---source suite/funcs_1/include/show_connection.inc - -# cleanup -DROP USER user_4_1_8@localhost; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.9:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.9: Ensure that no user may alter the definition of an -# INFORMATION_SCHEMA table. -################################################################################ - -#FIXME: 3.2.1.9 check for better error message than ERROR 42S02: Table 'information_schema.schemata' doesn't exist - -# first simple check all known - so we never forget one ... -let $message= root: alter a table from other db; -let $dd_part1= ALTER TABLE information_schema.; -let $dd_part2= ADD f1 INT; -#FIXME: check change from error 1146 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -use information_schema; -let $message= root: alter a table from directly; -let $dd_part1= ALTER TABLE ; -let $dd_part2= ADD f1 INT; -#FIXME: check change from error 1146 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -# now more detailed checks ---error ER_DBACCESS_DENIED_ERROR -alter table schemata add f1 int; ---error ER_DBACCESS_DENIED_ERROR -alter table tables drop primary key; ---error ER_DBACCESS_DENIED_ERROR -alter table columns add f1 int; ---error ER_DBACCESS_DENIED_ERROR -alter table character_sets disable keys; ---error ER_DBACCESS_DENIED_ERROR -alter table collations enable keys; ---error ER_DBACCESS_DENIED_ERROR -alter table collation_character_set_applicability add f1 int; ---error ER_DBACCESS_DENIED_ERROR -alter table routines discard tablespace; ---error ER_DBACCESS_DENIED_ERROR -alter table statistics import tablespace; ---error ER_DBACCESS_DENIED_ERROR -alter table views drop column table_name; ---error ER_DBACCESS_DENIED_ERROR -alter table user_privileges drop index privilege_type; ---error ER_DBACCESS_DENIED_ERROR -alter table schema_privileges drop column is_grantable; ---error ER_DBACCESS_DENIED_ERROR -alter table table_privileges order by constraint_type; ---error ER_DBACCESS_DENIED_ERROR -alter table column_privileges rename to aaxyz; ---error ER_DBACCESS_DENIED_ERROR -alter table table_constraints order by schema_name; ---error ER_DBACCESS_DENIED_ERROR -alter table key_column_usage rename to information_schema.aabxyz; ---error ER_DBACCESS_DENIED_ERROR -alter table triggers rename to information_schema.sql_mode; -# Alter an information_schema table as a limited user with sufficient permissions - -CREATE USER user_4_1_9@localhost; - -grant select, alter, create, insert on *.* to user_4_1_9@localhost; - -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u5, localhost, user_4_1_9, , db_datadict); ---source suite/funcs_1/include/show_connection.inc - -use db_datadict; - -let $message= user: alter a table from other db; -let $dd_part1= ALTER TABLE information_schema.; -let $dd_part2= ADD f1 INT; -#FIXME: check change from error 1146 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -use information_schema; -let $message= user: alter a table from directly; -let $dd_part1= ALTER TABLE ; -let $dd_part2= ADD f1 INT; -#FIXME: check change from error 1146 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -disconnect u5; - -# cleanup -connection default; ---source suite/funcs_1/include/show_connection.inc -DROP USER user_4_1_9@localhost; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.10:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table. -################################################################################ - -use information_schema; - -let $message= root: drop a table from IS; -let $dd_part1= DROP TABLE ; -let $dd_part2=; -#FIXME: check change from error 1051 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -use db_datadict; - -let $message= root: drop a table from other db; -let $dd_part1= DROP TABLE information_schema.; -let $dd_part2=; -#FIXME: check change from error 1051 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -use information_schema; - -# drop an information_schema table as a limited user with sufficient permissions - -CREATE USER user_4_1_10@localhost; - -GRANT SELECT, DROP ON *.* TO user_4_1_10@localhost; - -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u6,localhost,user_4_1_10,,db_datadict); - -use information_schema; ---source suite/funcs_1/include/show_connection.inc - -let $message= user: drop a table from IS; -let $dd_part1= DROP TABLE ; -let $dd_part2=; -#FIXME: check change from error 1051 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -use db_datadict; - -let $message= user: drop a table from other db; -let $dd_part1= DROP TABLE information_schema.; -let $dd_part2=; -#FIXME: check change from error 1051 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -disconnect u6; - -connection default; ---source suite/funcs_1/include/show_connection.inc - -# cleanup -DROP USER user_4_1_10@localhost; - -# Try to carry out information_schema modification operations with a user other than root having SUPER privileges -CREATE USER user_4_1_11@localhost; - -GRANT SUPER ON *.* TO user_4_1_11@localhost; - -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u7,localhost,user_4_1_11, ,test); - -use information_schema; ---source suite/funcs_1/include/show_connection.inc - ---error ER_DBACCESS_DENIED_ERROR -drop table routines; - ---error ER_DBACCESS_DENIED_ERROR -alter table collations enable keys; - ---error ER_DBACCESS_DENIED_ERROR -create index i5 on collations( collation_name ); - ---error ER_UNKNOWN_TABLE -create view v1 as select * from schemata; - ---error ER_DBACCESS_DENIED_ERROR -delete from columns; - ---error ER_DBACCESS_DENIED_ERROR -update columns set table_name = 't4' where column_name = 'f2'; - ---error ER_DBACCESS_DENIED_ERROR -insert into collations ( collation_name, character_set_name, id, is_default, - is_compiled, sortlen) - values ('cp1251_bin', 'cp1251', 50, '', '', 0); - -disconnect u7; - -connection default; ---source suite/funcs_1/include/show_connection.inc -DROP USER user_4_1_11@localhost; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.11:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table -# to any other database. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings - -CREATE DATABASE db_datadict; -CREATE USER 'u_6_401011'@'localhost'; - -#FIXME: check that GRANT ON i_s is no longer allowed ---error ER_DBACCESS_DENIED_ERROR -GRANT ALL ON information_schema.* TO 'u_6_401011'@'localhost'; -GRANT ALL ON db_datadict.* TO 'u_6_401011'@'localhost'; - -FLUSH PRIVILEGES; - ---error ER_DBACCESS_DENIED_ERROR -ALTER TABLE information_schema.schemata RENAME db_datadict.schemata; - -let $message= root: move table to other DB; -let $dd_part1= ALTER TABLE information_schema.; -let $dd_part2= RENAME db_datadict.tb_01; -#FIXME: check change from error 1146 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u_6_401011, localhost, u_6_401011, , db_datadict); - -USE information_schema; ---source suite/funcs_1/include/show_connection.inc - ---error ER_DBACCESS_DENIED_ERROR -ALTER TABLE information_schema.schemata RENAME db_datadict.schemata; - -let $message= user: move table to other DB; -let $dd_part1= ALTER TABLE information_schema.; -let $dd_part2= RENAME db_datadict.tb_01; -#FIXME: check change from error 1146 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -disconnect u_6_401011; - -connection default; ---source suite/funcs_1/include/show_connection.inc - -#cleanup ---disable_warnings -#DROP DATABASE db_datadict; -DROP TABLE IF EXISTS db_datadict.schemata; -DROP USER 'u_6_401011'@'localhost'; ---enable_warnings -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.12:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.12: Ensure that no user may directly add to, alter, or delete -# any data in an INFORMATION_SCHEMA table. -################################################################################ - -# first as root a DELETE check on all tables -let $message= root: delete from IS tables; -let $dd_part1= DELETE FROM information_schema.; -let $dd_part2=; -#FIXME: check change from error 1288 to 1044 ---source suite/funcs_1/datadict/datadict_tables_error_1044.inc -# check UPDATE for all ... ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.tables SET table_name = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.columns SET table_name = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.statistics SET table_name = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.views SET table_name = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.table_privileges SET table_name = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.column_privileges SET table_name = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.table_constraints SET table_name = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.key_column_usage SET table_name = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.schemata SET catalog_name = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.character_sets SET description = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.collations SET character_set_name = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.collation_character_set_applicability - SET character_set_name = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.routines SET routine_type = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.user_privileges SET grantee = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.schema_privileges SET grantee = 't_4711'; ---error ER_DBACCESS_DENIED_ERROR -UPDATE information_schema.triggers SET sql_mode = 't_4711'; - -CREATE USER 'u_6_401012'@'localhost'; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u_6_401012, localhost, u_6_401012, , test); - -use information_schema; - ---error ER_DBACCESS_DENIED_ERROR -insert into information_schema.schemata (catalog_name, schema_name, - default_character_set_name, sql_path) - values (null, information_schema1, utf16, null); -#FIXME: check later the change from 1142 to 1044 (since Mid Sep05) ---error ER_DBACCESS_DENIED_ERROR -alter table information_schema.schemata rename db_datadict1.schemata; -#FIXME: check later the change from 1146 to 1044 (since Mid Sep05) ---error ER_DBACCESS_DENIED_ERROR -alter table information_schema.tables drop column checksum; ---error ER_DBACCESS_DENIED_ERROR -alter table information_schema.statistics modify packed int; ---error ER_DBACCESS_DENIED_ERROR -alter table information_schema.routines modify created int not null; ---error ER_DBACCESS_DENIED_ERROR -alter table information_schema.key_column_usage drop column ordinal_position; ---error ER_DBACCESS_DENIED_ERROR -alter table information_schema.table_privileges - change privilege_type rights_approved varchar(32); ---error ER_DBACCESS_DENIED_ERROR -update columns set table_name = 't4' where column_name = 'f2'; ---error ER_DBACCESS_DENIED_ERROR -delete from information_schema.collations; - -disconnect u_6_401012; - -# cleanup -connection default; ---source suite/funcs_1/include/show_connection.inc - ---disable_warnings -drop table if exists db_datadict1.schemata; -DROP USER 'u_6_401012'@'localhost'; ---enable_warnings -#------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.1.13:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.13: Ensure that the creation of any new database object -# (e.g. table or column) automatically inserts all relevant -# information on that object into every appropriate -# INFORMATION_SCHEMA table. -################################################################################ - -use information_schema; - -let $dbname=db_datadict; -let $message= first check status >before< creating the objects ...; ---source suite/funcs_1/datadict/datadict_show_schema.inc - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings -CREATE DATABASE db_datadict; -USE db_datadict; - -eval create table res_t_401013(f1 char(10), f2 char(25), f3 int) - engine = $ENGINE_TYPE; -create view res_v_401013 as select * from res_t_401013; -CREATE USER u_6_401013@localhost; -create procedure sp_6_401013() select 'db_datadict'; -create function fn_6_401013() returns int return 0; -create index i_6_401013 on res_t_401013(f3); - -use information_schema; - -let $message= now check whether all new objects exists in IS ...; ---source suite/funcs_1/datadict/datadict_show_schema.inc - -# cleanup objects -use db_datadict; -drop index i_6_401013 on res_t_401013; -drop table db_datadict.res_t_401013; -drop view db_datadict.res_v_401013; -DROP USER u_6_401013@localhost; -drop procedure sp_6_401013; -drop function fn_6_401013; -drop database db_datadict; - -use information_schema; - -let $message= and now check whether all objects are removed from IS ...; ---source suite/funcs_1/datadict/datadict_show_schema.inc -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.14:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.14: Ensure that the alteration of any existing database object -# automatically updates all relevant information on that -# object in every appropriate INFORMATION_SCHEMA table. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings -CREATE DATABASE db_datadict; -USE db_datadict; - -create table res_t_401014(f1 char(10), f2 varchar(25), f3 int); -create view res_v_401014 as select * from res_t_401014; -create procedure sp_6_401014() select 'db_datadict'; -create function fn_6_401014() returns int return 0; - -# check current information in information_schema - -let $dbname=db_datadict; -let $message= show existing objects >before< changing them ...; ---source suite/funcs_1/datadict/datadict_show_schema.inc - -# alter objects - -use db_datadict; - -alter table res_t_401014 change f1 ff1 int; -eval alter table res_t_401014 engine = $OTHER_ENGINE_TYPE; -alter table res_t_401014 change f3 f3_new bigint; -alter view res_v_401014 as select ff1 from res_t_401014; -alter procedure sp_6_401014 sql security invoker; -alter function fn_6_401014 comment 'updated comments'; -alter database db_datadict character set utf8; - -# check updated information in information_schema -let $message= now check whether the changes are visible in IS ...; ---source suite/funcs_1/datadict/datadict_show_schema.inc - - -# cleanup - -use db_datadict; -drop table db_datadict.res_t_401014; -drop view db_datadict.res_v_401014; -drop procedure sp_6_401014; -drop function fn_6_401014; -drop database db_datadict; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.15:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.15: Ensure that the dropping of any existing database object -# automatically deletes all relevant information on that -# object from every appropriate INFORMATION_SCHEMA table. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings -CREATE DATABASE db_datadict; -USE db_datadict; - -create table res_t_401015(f1 char(10), f2 text(25), f3 int); -create view res_v_401015 as select * from res_t_401015; -CREATE USER u_6_401015@localhost; -create procedure sp_6_401015() select 'test'; -create function fn_6_401015() returns int return 0; -create index i_6_401015 on res_t_401015(f3); - -let $dbname=db_datadict; -let $message= show existing objects >before< dropping them ...; ---source suite/funcs_1/datadict/datadict_show_schema.inc - -use db_datadict; -drop index i_6_401015 on res_t_401015; -drop table db_datadict.res_t_401015; -drop view db_datadict.res_v_401015; -DROP USER u_6_401015@localhost; -drop procedure sp_6_401015; -drop function fn_6_401015; -#drop database db_datadict; - -let $message= now check they are really gone ...; ---source suite/funcs_1/datadict/datadict_show_schema.inc -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.16:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.16: Ensure that no user may use any INFORMATION_SCHEMA table to -# determine any information on a database and/or its -# structure unless authorized to get that information. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings -CREATE DATABASE db_datadict; - -CREATE DATABASE db_hidden; -USE db_hidden; -CREATE TABLE tb_hidden ( c1 TEXT ); - -USE db_datadict; - -CREATE TABLE res_t_401016(f1 char(10),f2 text(25),f3 int); -CREATE TABLE res_t_401016_1(f1 char(10),f2 text(25),f3 int); - -CREATE USER 'u_6_401016'@'localhost'; -GRANT SELECT ON db_datadict.res_t_401016 TO 'u_6_401016'@'localhost'; - -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u_6_401016, localhost, u_6_401016, , test); - -USE information_schema; - -SELECT table_schema, table_name, engine - FROM TABLES; -# WHERE table_name LIKE 'res_t_401016%'; - -SHOW TABLES; -SELECT * FROM schemata; - -disconnect u_6_401016; - -connection default; ---source suite/funcs_1/include/show_connection.inc - -#FIXME: check that GRANT ON i_s is no longer allowed ---error ER_DBACCESS_DENIED_ERROR -grant usage on information_schema.* to 'u_6_401016'@'localhost'; -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u_6_401016_1, localhost, u_6_401016, , db_datadict); - -USE information_schema; -SHOW TABLES; -SELECT * FROM schemata; - -disconnect u_6_401016_1; - -# all tables are checked again later with permission tests - -# cleanup -connection default; -use db_datadict; ---source suite/funcs_1/include/show_connection.inc -DROP USER 'u_6_401016'@'localhost'; -drop table res_t_401016; -drop table res_t_401016_1; -DROP DATABASE db_hidden; -#drop database db_datadict; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.17:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.17: Ensure that the SELECT privilege is granted TO PUBLIC WITH -# GRANT OPTION on every INFORMATION_SCHEMA table. -################################################################################ - -CREATE USER 'u_6_401017'@'localhost'; - -#FIXME: check that GRANT ON i_s is no longer allowed ---error ER_DBACCESS_DENIED_ERROR -grant select on information_schema.* to u_6_401017@localhost; - -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u_6_401017, localhost, u_6_401017, , test); - -use information_schema; - -select * from collation_character_set_applicability -where collation_name <> 'utf8_general_cs'; -select * from schemata; -select table_name from tables; ---source suite/funcs_1/datadict/datadict_bug_12777.inc -select table_name, column_name, column_type from columns; -select character_set_name from character_sets; -select collation_name from collations where collation_name <> 'utf8_general_cs'; -select routine_name, routine_type from routines; -select table_name, index_name from statistics; -select table_name from views; -select privilege_type from user_privileges; -select grantee, privilege_type from schema_privileges; -select * from table_privileges; -select column_name, privilege_type from column_privileges; -select table_name,constraint_type from table_constraints; -select table_schema, table_name, column_name from key_column_usage; - -disconnect u_6_401017; - -# cleanup -connection default; ---source suite/funcs_1/include/show_connection.inc -DROP USER 'u_6_401017'@'localhost'; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.18:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.18: Ensure that the CREATE VIEW privilege on an -# INFORMATION_SCHEMA table may be granted to any user. -################################################################################ - -CREATE USER 'u_6_401018'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -GRANT CREATE VIEW ON information_schema.* TO 'u_6_401018'@'localhost'; -GRANT ALL ON db_datadict.* TO 'u_6_401018'@'localhost'; - -SHOW GRANTS FOR 'u_6_401018'@'localhost'; -FLUSH PRIVILEGES; - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings -CREATE DATABASE db_datadict; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u_6_401018, localhost, u_6_401018, , test); - -USE db_datadict; - -create view db_datadict.v_401018 as - select * from information_schema.schemata; -SELECT * FROM v_401018 ORDER BY 2 DESC; - -disconnect u_6_401018; - -#cleanup -connection default; ---source suite/funcs_1/include/show_connection.inc -DROP USER 'u_6_401018'@'localhost'; -DROP DATABASE db_datadict; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.19:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.19: Ensure that no other privilege on an INFORMATION_SCHEMA -# table is granted, or may be granted, to any user. -################################################################################ - -CREATE USER 'u_6_401019'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -grant alter on information_schema.* to 'u_6_401019'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -grant alter routine on information_schema.* to 'u_6_401019'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -grant create on information_schema.* to 'u_6_401019'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -grant create routine on information_schema.* to 'u_6_401019'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -grant create temporary tables - on information_schema.* to 'u_6_401019'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -grant delete on information_schema.* to 'u_6_401019'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -grant drop on information_schema.* to 'u_6_401019'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -grant execute on information_schema.* to 'u_6_401019'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -grant index on information_schema.* to 'u_6_401019'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -grant insert on information_schema.* to 'u_6_401019'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -grant lock tables on information_schema.* to 'u_6_401019'@'localhost'; - -#FIXME: check GRANT on IS ---error ER_DBACCESS_DENIED_ERROR -grant update on information_schema.* to 'u_6_401019'@'localhost'; - -SELECT * FROM information_schema.table_privileges - WHERE table_schema = "information_schema"; -SELECT * FROM information_schema.column_privileges - WHERE table_schema = "information_schema"; - -# cleanup -DROP USER 'u_6_401019'@'localhost'; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.1.20:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.1.20: Ensure that USE INFORMATION_SCHEMA allows the user to -# switch to the INFORMATION_SCHEMA database, for query -# purposes only. -################################################################################ - -CREATE USER 'u_6_401020'@'localhost'; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u_6_401020, localhost, u_6_401020, , test); - -USE information_schema; -SELECT * FROM schemata; - ---error ER_UNKNOWN_TABLE -CREATE TABLE tb_not_allowed ( col TEXT ); -#FIXME 3.2.1.20: bad message: ERROR 42S02: Unknown table 'tb_not_allowed' in information_schema -#FIXME 3.2.1.20: better: ERROR 42000: Access denied for user 'u_6_401020'@'localhost' to database 'information_schema' - ---error ER_UNKNOWN_TABLE -create view res_v1 as select * from information_schema.schemata; - ---error ER_DBACCESS_DENIED_ERROR -alter table schemata modify catalog_name varchar(255); - ---error ER_DBACCESS_DENIED_ERROR -update schemata set catalog_name = 'abc' - where schema_name = 'information_schema'; - -delimiter //; ---error ER_BAD_DB_ERROR -CREATE PROCEDURE sp_3_2_1_20() - BEGIN - INSERT INTO information_schema.schema_privileges (table_schema,privilege_type) - VALUES('db2','insert'); - END// -delimiter ;// - ---error ER_DBACCESS_DENIED_ERROR -DELETE FROM schemata WHERE schema_name = 'information_schema'; - -disconnect u_6_401020; - -# cleanup -connection default; ---source suite/funcs_1/include/show_connection.inc -DROP USER 'u_6_401020'@'localhost'; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.2.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.2.1: Ensure that the INFORMATION_SCHEMA.CHARACTER_SETS -# table has the following columns, in the following order: -# -# CHARACTER_SET_NAME (shows a character set name), -# DEFAULT_COLLATE_NAME (shows the name of the default -# collation for that character set), -# DESCRIPTION (shows a descriptive name for that character -# set), -# MAXLEN (shows the number of bytes used to store each -# character supported by that character set). -################################################################################ - -let $is_table= character_sets; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.2.2:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.2.2: Ensure that the table shows the relevant information on -# every character set for which the current user or PUBLIC -# have the USAGE privilege. -################################################################################ - ---source suite/funcs_1/include/show_connection.inc -SELECT * FROM information_schema.character_sets; -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.2.3:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.2.3: Ensure that the table shows the relevant information on -# every character set for which the current user or PUBLIC -# have the USAGE privilege. -################################################################################ - -# Test requirement is erroneous... we cannot grant / revoke privilege for using -# a character set. -# ------------------------------------------------------------------------------ - -let $message= Testcase 3.2.3.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.3.1: Ensure that the INFORMATION_SCHEMA.COLLATIONS -# table has the following columns, in the following order: -# -# COLLATION_NAME (shows a collation name), -# CHARACTER_SET_NAME (shows the name of the character set to -# which the collation applies), -# ID (shows a numeric identifier for that collation/character -# set combination), -# IS_DEFAULT (shows whether the collation is the default -# collation for the character set shown), -# IS_COMPILED (indicates whether the collation is compiled -# into the MySQL server), -# SORTLEN (shows a value related to the amount of memory -# required to sort strings using this -# collation/character set combination). -################################################################################ - -let $is_table= collations; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.3.2:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.3.2: Ensure that the table shows the relevant information on -# every collation for which the current user or PUBLIC have -# the USAGE privilege. -################################################################################ - -SELECT * FROM collations where collation_name <> 'utf8_general_cs'; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.3.3:; ---source include/show_msg80.inc - -############################################################################### -# Testcase 3.2.3.3: Ensure that the table does not show any information on any -# collations for which the current user and PUBLIC have no -# USAGE privilege. -################################################################################ - -# Test requirement is erroneous... we cannot grant / revoke privilege for using -# a collation. -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.4.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.4.1: Ensure that the -# INFORMATION_SCHEMA.COLLATION_CHARACTER_SET_APPLICABILITY -# table has the following columns, in the following order: -# -# COLLATION_NAME (shows the name of a collation), -# CHARACTER_SET_NAME (shows the name of a character set to -# which that collation applies). -################################################################################ - -let $is_table= collation_character_set_applicability; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.4.2:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.4.2: Ensure that the table shows the relevant information on -# every collation/character set combination for which the -# current user or PUBLIC have the USAGE privilege. -# Note(2007-08-24 mleich): -# The amount of collations/character sets grows with new -# MySQL releases and is a reason why this test might -# fail with differences. Please check the new entries -# and update with expected results afterwards. -################################################################################ - -SELECT * FROM collation_character_set_applicability -where collation_name <> 'utf8_general_cs'; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.4.3:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.4.3: Ensure that the table does not show any information on any -# collation/character set combinations for which the current -# user and PUBLIC have no USAGE privilege. -################################################################################ - -# Test requirement is erroneous... we cannot grant / revoke privilege for using a collation. -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.5.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.5.1: Ensure that the INFORMATION_SCHEMA.COLUMN_PRIVILEGES -# table has the following columns, in the following order: -# -# GRANTEE (shows the name of a user who has either granted, -# or been granted a column privilege), -# TABLE_CATALOG (always shows NULL), -# TABLE_SCHEMA (shows the name of the schema, or database, -# in which the table for which a column privilege has -# been granted resides), -# TABLE_NAME (shows the name of the table), -# COLUMN_NAME (shows the name of the column on which a -# column privilege has been granted), -# PRIVILEGE_TYPE (shows the type of privilege that was -# granted; must be either SELECT, INSERT, UPDATE, or -# REFERENCES), -# IS_GRANTABLE (shows whether that privilege was granted -# WITH GRANT OPTION). -################################################################################ - -let $is_table= column_privileges; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.5.2 + 3.2.5.3 + 3.2.5.4:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.5.2: Ensure that the table shows the relevant information on -# every column privilege which has been granted to the -# current user or PUBLIC, or which was granted by the current -# user. -################################################################################ -# Testcase 3.2.5.3: Ensure that the table does not show any information on any -# column privilege which was granted to any user other than -# the current user or PUBLIC, or which was granted by any -# user other than the current user. -################################################################################ -# Testcase 3.2.5.4: Ensure that the table does not show any information on any -# privileges that are not column privileges for the current -# user. -################################################################################ - -CREATE USER 'user_1'@'localhost'; -CREATE USER 'user_2'@'localhost'; -CREATE USER 'user_3'@'localhost'; - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings -CREATE DATABASE db_datadict; -USE db_datadict; - -CREATE TABLE db_datadict.res_t40502 (f1 INT, f2 DECIMAL, f3 TEXT); - -GRANT SELECT(f1, f3) ON db_datadict.res_t40502 TO 'user_1'@'localhost'; -GRANT INSERT(f1) ON db_datadict.res_t40502 TO 'user_1'@'localhost'; -GRANT UPDATE(f2) ON db_datadict.res_t40502 TO 'user_1'@'localhost'; -GRANT SELECT(f2) ON db_datadict.res_t40502 TO 'user_2'@'localhost'; -GRANT INSERT, SELECT ON db_datadict.res_t40502 TO 'user_3'@'localhost'; -GRANT SELECT(f3) ON db_datadict.res_t40502 TO 'user_3'@'localhost'; - -GRANT INSERT, SELECT ON db_datadict.res_t40502 TO 'user_3'@'localhost' WITH GRANT OPTION; -GRANT ALL ON db_datadict.* TO 'user_3'@'localhost'; - -let $select= SELECT * FROM information_schema.column_privileges - WHERE grantee LIKE "'user%" - ORDER BY grantee, table_name, column_name, privilege_type; -eval $select; - -let $message= FIXME: Check it is correct that the following GRANT changes ALL privs that user_1 has; ---source include/show_msg.inc - -GRANT UPDATE(f3) ON db_datadict.res_t40502 TO 'user_1'@'localhost' WITH GRANT OPTION; - -eval $select; - -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_5_1, localhost, user_1, , db_datadict); -eval $select; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_5_2, localhost, user_2, , db_datadict); -eval $select; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_5_3, localhost, user_3, , db_datadict); - -let $message= FIXME: check it is correct that granted TABLES doesn_t occur in COLUMN_PRIVILEGES; ---source include/show_msg.inc -SELECT * FROM information_schema.table_privileges WHERE grantee LIKE "'user%"; -SELECT * FROM information_schema.schema_privileges WHERE grantee LIKE "'user%"; -eval $select; -GRANT SELECT(f1, f3) ON db_datadict.res_t40502 TO 'user_2'@'localhost'; - -let $message= FIXME: check whether it is intended that *my* grants to others are *NOT* shown here; ---source include/show_msg.inc -eval $select; - -connection user_5_2; ---source suite/funcs_1/include/show_connection.inc -eval $select; - -disconnect user_5_1; -disconnect user_5_2; -disconnect user_5_3; - -#cleanup -connection default; ---source suite/funcs_1/include/show_connection.inc ---disable_warnings -DROP TABLE IF EXISTS db_datadict.res_t40502; -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings - -DROP USER 'user_1'@'localhost'; -DROP USER 'user_2'@'localhost'; -DROP USER 'user_3'@'localhost'; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.6.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.6.1: Ensure that the INFORMATION_SCHEMA.COLUMNS table has the -# following columns, in the following order: -# -# TABLE_CATALOG (always shows NULL), -# TABLE_SCHEMA (shows the name of the database, or schema, -# in which an accessible table resides), -# TABLE_NAME (shows the name of an accessible table), -# COLUMN_NAME (shows the name of a column within that -# table), -# ORDINAL_POSITION (shows the ordinal position of that -# column in that table), -# COLUMN_DEFAULT (shows the column's default value), -# IS_NULLABLE (shows whether the column may accept NULL -# values), -# DATA_TYPE (shows the column's defined data type; keyword -# only), -# CHARACTER_MAXIMUM_LENGTH (shows, for a string column, the -# column's defined maximum length in characters; -# otherwise NULL), -# CHARACTER_OCTET_LENGTH (shows, for a string column, the -# column's defined maximum length in octets; -# otherwise NULL), -# NUMERIC_PRECISION (shows, for a numeric column, the -# column's or data type's defined precision; -# otherwise NULL), -# NUMERIC_SCALE (shows, for a numeric column, the column's -# or data type's defined scale; otherwise NULL), -# CHARACTER_SET_NAME (shows, for a character string column, -# the column's default character set; otherwise NULL), -# COLLATION_NAME (shows, for a character string column, the -# column's default collation; otherwise NULL), -# COLUMN_TYPE (shows the column's complete, defined data -# type), -# COLUMN_KEY (shows whether the column is indexed; possible -# values are PRI if the column is part of a PRIMARY -# KEY, UNI if the column is part of a UNIQUE key, MUL -# if the column is part of an index key that allows -# duplicates), -# EXTRA (shows any additional column definition information, -# e.g. whether the column was defined with the -# AUTO_INCREMENT attribute), -# PRIVILEGES (shows the privileges available to the user on -# the column), -# COLUMN_COMMENT (shows the comment, if any, defined for the -# comment; otherwise NULL). -################################################################################ - -let $is_table= columns; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.6.2 + 3.2.6.3:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.6.2: Ensure that the table shows the relevant information on the -# columns of every table that is accessible to the current -# user or to PUBLIC. -################################################################################ -# Testcase 3.2.6.3: Ensure that the table does not show any information on the -# columns of any table which is not accessible to the current -# user or PUBLIC. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings -CREATE DATABASE db_datadict; - -CREATE USER 'user_1'@'localhost'; -CREATE USER 'user_2'@'localhost'; - -USE db_datadict; - -create table t_6_406001(f1 char(10), f2 text, f3 date, f4 int); -grant select(f1, f2) on db_datadict.t_6_406001 to 'user_1'@'localhost'; - -create table t_6_406002(f1 char(10), f2 text, f3 date, f4 int); -GRANT INSERT(f1, f2) ON db_datadict.t_6_406002 TO 'user_2'@'localhost'; - -FLUSH PRIVILEGES; - -let $select= SELECT * FROM information_schema.columns - ORDER BY table_schema, table_name, ordinal_position; - -# show view of user root ---source suite/funcs_1/datadict/datadict_bug_12777.inc -eval $select; - -# reconnect to mysql with user credential of user u_6_406002_1. ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_6_1, localhost, user_1, , db_datadict); ---source suite/funcs_1/datadict/datadict_bug_12777.inc -eval $select; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_6_2, localhost, user_2, , db_datadict); ---source suite/funcs_1/datadict/datadict_bug_12777.inc -eval $select; - -disconnect user_6_1; -disconnect user_6_2; - -connection default; ---source suite/funcs_1/include/show_connection.inc - -let $message= Show the quotient of COL and CML for all COLUMNS; ---source include/show_msg.inc -SELECT DISTINCT - CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, - DATA_TYPE, - CHARACTER_SET_NAME, - COLLATION_NAME - FROM information_schema.columns - WHERE CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH = 1 - ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; - -#FIXME 3.2.6.2: check the value 2.0079 tinytext ucs2 ucs2_general_ci -SELECT DISTINCT - CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, - DATA_TYPE, - CHARACTER_SET_NAME, - COLLATION_NAME - FROM information_schema.columns - WHERE CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH <> 1 - ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; - -SELECT DISTINCT - CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, - DATA_TYPE, - CHARACTER_SET_NAME, - COLLATION_NAME - FROM information_schema.columns - WHERE CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH IS NULL - ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; - -echo --> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values; -echo --> are 0, which is intended behavior, and the result of 0 / 0 IS NULL; ---source suite/funcs_1/datadict/datadict_bug_12777.inc -SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, - TABLE_SCHEMA, - TABLE_NAME, - COLUMN_NAME, - DATA_TYPE, - CHARACTER_MAXIMUM_LENGTH, - CHARACTER_OCTET_LENGTH, - CHARACTER_SET_NAME, - COLLATION_NAME, - COLUMN_TYPE - FROM information_schema.columns - ORDER BY TABLE_SCHEMA, TABLE_NAME, ORDINAL_POSITION; - -#cleanup -DROP USER 'user_1'@'localhost'; -DROP USER 'user_2'@'localhost'; -DROP TABLE IF EXISTS t_6_406001; -DROP TABLE IF EXISTS t_6_406002; -DROP DATABASE IF EXISTS db_datadict; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.7.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.7.1: Ensure that the INFORMATION_SCHEMA.KEY_COLUMN_USAGE -# table has the following columns, in the following order: -# -# CONSTRAINT_CATALOG (always shows NULL), -# CONSTRAINT_SCHEMA (shows the database, or schema, in which -# an accessible constraint, or index, resides), -# CONSTRAINT_NAME (shows the name of the accessible -# constraint), -# TABLE_CATALOG (always shows NULL), -# TABLE_SCHEMA (shows the database, or schema, in which the -# table constrained by that constraint resides), -# TABLE_NAME (shows the name of the table constrained by the -# constraint), -# COLUMN_NAME (shows the name of a column that is the index -# key, or part of the index key), -# ORDINAL_POSITION (shows the ordinal position of the column -# within the constraint index), -# POSITION_IN_UNIQUE_CONSTRAINT (shows, for a foreign key -# column, the ordinal position of the referenced -# column within the referenced unique index; -# otherwise NULL). -# added with 5.0.6: REFERENCED_TABLE_SCHEMA, -# REFERENCED_TABLE_NAME, -# REFERENCED_COLUMN_NAME -################################################################################ - -let $is_table= key_column_usage; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.7.2 + 3.2.7.3:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.7.2: Ensure that the table shows the relevant information on -# every column, defined to be part of an index key, which is -# accessible to the current user or to PUBLIC. -################################################################################ -# Testcase 3.2.7.3: Ensure that the table does not show any information on any -# indexed column that is not accessible to the current user -# or PUBLIC. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings -CREATE DATABASE db_datadict; - -CREATE USER 'user_1'@'localhost'; -CREATE USER 'user_2'@'localhost'; - -USE db_datadict; - -CREATE TABLE t_40701 ( - f1 INT NOT NULL, PRIMARY KEY(f1), - f2 INT, INDEX f2_ind(f2) - ); -GRANT SELECT ON t_40701 to 'user_1'@'localhost'; - -CREATE TABLE t_40702 ( - f1 INT NOT NULL, PRIMARY KEY(f1), - f2 INT, INDEX f2_ind(f2) - ); -GRANT SELECT ON t_40702 to 'user_2'@'localhost'; -#FIXME: add foreign keys - -FLUSH PRIVILEGES; - -let $select= SELECT * FROM information_schema.key_column_usage - ORDER BY constraint_catalog, constraint_schema, constraint_name, - table_catalog, table_schema, table_name, ordinal_position; - -# show view of user root -eval $select; - -# reconnect to mysql with user credential of user u_6_406002_1. ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_7_1, localhost, user_1, , db_datadict); -eval $select; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_7_2, localhost, user_2, , db_datadict); -eval $select; - -disconnect user_7_1; -disconnect user_7_2; - -#cleanup -connection default; ---source suite/funcs_1/include/show_connection.inc -DROP USER 'user_1'@'localhost'; -DROP USER 'user_2'@'localhost'; -DROP TABLE t_40701; -DROP TABLE t_40702; -DROP DATABASE IF EXISTS db_datadict; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.8.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.8.1: Ensure that the INFORMATION_SCHEMA.ROUTINES -# table has the following columns, in the following order: -# -# SPECIFIC_NAME (shows the name of an accessible stored -# procedure, or routine), -# ROUTINE_CATALOG (always shows NULL), -# ROUTINE_SCHEMA (shows the database, or schema, in which -# the routine resides), -# ROUTINE_NAME (shows the same stored procedure name), -# ROUTINE_TYPE (shows whether the stored procedure is a -# procedure or a function), -# DTD_IDENTIFIER (shows, for a function, the complete -# data type definition of the value the function will -# return; otherwise NULL), -# ROUTINE_BODY (shows the language in which the stored -# procedure is written; currently always SQL), -# ROUTINE_DEFINITION (shows as much of the routine body as -# is possible in the allotted space), -# EXTERNAL_NAME (always shows NULL), -# EXTERNAL_LANGUAGE (always shows NULL), -# PARAMETER_STYLE (shows the routine's parameter style; -# always SQL), -# IS_DETERMINISTIC (shows whether the routine is -# deterministic), -# SQL_DATA_ACCESS (shows the routine's defined -# sql-data-access clause value), -# SQL_PATH (always shows NULL), -# SECURITY_TYPE (shows whether the routine's defined -# security_type is 'definer' or 'invoker'), -# CREATED (shows the timestamp of the time the routine was -# created), -# LAST_ALTERED (shows the timestamp of the time the routine -# was last altered), -# SQL_MODE (shows the sql_mode setting at the time the -# routine was created), -# ROUTINE_COMMENT (shows the comment, if any, defined for -# the routine; otherwise NULL), -# DEFINER (shows the user who created the routine). -################################################################################ - -let $is_table= routines; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.8.2 + 3.2.8.3:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.8.2: Ensure that the table shows the relevant information on -# every SQL-invoked routine (i.e. stored procedure) which is -# accessible to the current user or to PUBLIC. -################################################################################ -# Testcase 3.2.8.3: Ensure that the table does not show any information on any -# stored procedure that is not accessible to the current user -# or PUBLIC.; -############################################################################## - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; -DROP DATABASE IF EXISTS db_datadict_2; ---enable_warnings - -CREATE DATABASE db_datadict; -USE db_datadict; - -CREATE USER 'user_1'@'localhost'; -CREATE USER 'user_2'@'localhost'; -CREATE USER 'user_3'@'localhost'; - -CREATE TABLE res_6_408002_1(f1 CHAR(3), f2 TEXT(25), f3 DATE, f4 INT); - -INSERT INTO res_6_408002_1(f1, f2, f3, f4) - VALUES('abc', 'xyz', '1989-11-09', 0815); - ---disable_warnings -DROP PROCEDURE IF EXISTS sp_6_408002_1; ---enable_warnings - -delimiter //; -CREATE PROCEDURE sp_6_408002_1() -BEGIN - SELECT * FROM db_datadict.res_6_408002_1; -END// -delimiter ;// - -CREATE DATABASE db_datadict_2; -USE db_datadict_2; - -CREATE TABLE res_6_408002_2(f1 CHAR(3), f2 TEXT(25), f3 DATE, f4 INT); - -INSERT INTO res_6_408002_2(f1, f2, f3, f4) - VALUES('abc', 'xyz', '1990-10-03', 4711); - ---disable_warnings -DROP PROCEDURE IF EXISTS sp_6_408002_2; ---enable_warnings - -delimiter //; -CREATE PROCEDURE sp_6_408002_2() -BEGIN - SELECT * FROM db_datadict_2.res_6_408002_2; -END// -delimiter ;// - -GRANT SELECT ON db_datadict_2.* TO 'user_1'@'localhost'; -GRANT EXECUTE ON db_datadict_2.* TO 'user_1'@'localhost'; - -GRANT EXECUTE ON db_datadict.* TO 'user_1'@'localhost'; -GRANT SELECT ON db_datadict.* TO 'user_2'@'localhost'; - -GRANT EXECUTE ON PROCEDURE db_datadict_2.sp_6_408002_2 TO 'user_2'@'localhost'; -GRANT EXECUTE ON db_datadict_2.* TO 'user_2'@'localhost'; -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_8_1, localhost, user_1, , db_datadict); - ---replace_column 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -SELECT * FROM information_schema.routines; -disconnect user_8_1; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_8_2, localhost, user_2, , db_datadict); - ---replace_column 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -SELECT * FROM information_schema.routines; -disconnect user_8_2; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_8_3, localhost, user_3, , test); - ---replace_column 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -SELECT * FROM information_schema.routines; -disconnect user_8_3; - -# clean-up -connection default; ---source suite/funcs_1/include/show_connection.inc -DROP USER 'user_1'@'localhost'; -DROP USER 'user_2'@'localhost'; -DROP USER 'user_3'@'localhost'; - -use db_datadict; -DROP TABLE res_6_408002_1; -DROP PROCEDURE sp_6_408002_1; - -USE db_datadict_2; -DROP TABLE res_6_408002_2; -DROP PROCEDURE sp_6_408002_2; - -USE test; -DROP DATABASE db_datadict; -DROP DATABASE db_datadict_2; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.8.4:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.8.4: Ensure that a stored procedure with a routine body that is -# too large to fit into the -# INFORMATION_SCHEMA.ROUTINES.ROUTINE_DEFINITION column -# correctly shows as much of the information as is possible -# within the allotted size. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings - -CREATE DATABASE db_datadict; -USE db_datadict; - -create table res_6_408004_1(f1 longtext , f2 mediumint , f3 longblob , f4 real , f5 year); - -insert into res_6_408004_1 values ('abc', 98765 , 99999999 , 98765, 10); - ---disable_warnings -drop procedure if exists sp_6_408004; ---enable_warnings - -create table res_6_408004_2(f1 longtext , f2 mediumint , f3 longblob , f4 real , f5 year); - -insert into res_6_408004_2 values ('abc', 98765 , 99999999 , 98765, 10); - -let $message= Checking the max. possible length of (currently) 4 GByte is not possible in this environment here.; ---source include/show_msg.inc - -delimiter //; -create procedure sp_6_408004 () -begin - declare done integer default 0; - declare variable_number_1 longtext; - declare variable_number_2 mediumint; - declare variable_number_3 longblob; - declare variable_number_4 real; - declare variable_number_5 year; - declare cursor_number_1 cursor for select * from res_6_408004_1 limit 0, 10; - declare cursor_number_2 cursor for select * from res_6_408004_1 limit 0, 10; - declare cursor_number_3 cursor for select * from res_6_408004_1 limit 0, 10; - declare cursor_number_4 cursor for select * from res_6_408004_1 limit 0, 10; - declare cursor_number_5 cursor for select * from res_6_408004_1 limit 0, 10; - declare continue handler for sqlstate '02000' set done = 1; - begin - open cursor_number_1; - while done <> 1 do - fetch cursor_number_1 into variable_number_1, variable_number_2, variable_number_3, variable_number_4, variable_number_5; - if done <> 0 then - insert into res_6_408004_2 values (variable_number_1, variable_number_2, variable_number_3, - variable_number_4, variable_number_5); - end if; - end while; - begin - begin - set done = 0; - open cursor_number_2; - while done <> 1 do - fetch cursor_number_2 into variable_number_1, variable_number_2, variable_number_3, variable_number_4, variable_number_5; - if done <> 0 then - insert into res_6_408004_2 values(variable_number_1, variable_number_2, variable_number_3, variable_number_4, variable_number_5); - end if; - end while; - end; - set done = 0; - open cursor_number_3; - while done <> 1 do - fetch cursor_number_3 into variable_number_1, variable_number_2, variable_number_3, variable_number_4, variable_number_5; - if done <> 0 then - insert into res_6_408004_2 values(variable_number_1, variable_number_2, variable_number_3, variable_number_4, variable_number_5); - end if; - end while; - end; - end; - begin - set done = 0; - open cursor_number_4; - while done <> 1 do - fetch cursor_number_4 into variable_number_1, variable_number_2, variable_number_3, variable_number_4, variable_number_5; - if done <> 0 then - insert into res_6_408004_2 values (variable_number_1, variable_number_2, variable_number_3, variable_number_4, variable_number_5); - end if; - end while; - end; - begin - set @a='test row'; - select @a; - select @a; - select @a; - end; - begin - set done = 0; - open cursor_number_5; - while done <> 1 do - fetch cursor_number_5 into variable_number_1, variable_number_2, variable_number_3, variable_number_4, variable_number_5; - if done <> 0 then - insert into res_6_408004_2 values (variable_number_1, variable_number_2, variable_number_3, variable_number_4, variable_number_5); - end if; - end while; - end; - begin - set @a='test row'; - select @a; - select @a; - select @a; - end; -end// -delimiter ;// - -call sp_6_408004 (); -select * from res_6_408004_2; - ---vertical_results ---replace_column 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -SELECT *, LENGTH(routine_definition) - FROM information_schema.routines - WHERE routine_schema = 'db_datadict'; ---horizontal_results - -# clean-up -use db_datadict; -drop procedure sp_6_408004; -drop table res_6_408004_1; -drop table res_6_408004_2; -use test; -drop database db_datadict; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.9.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.9.1: Ensure that the INFORMATION_SCHEMA.SCHEMATA -# table has the following columns, in the following order: -# -# CATALOG_NAME (always shows NULL), -# SCHEMA_NAME (shows the name of a database, or schema, on -# which the current user or PUBLIC has privileges), -# DEFAULT_CHARACTER_SET_NAME (shows the name of that -# database's default character set), -# DEFAULT_COLLATION_NAME (shows the database default -# collation) -# SQL_PATH (always shows NULL). -################################################################################ - -let $is_table= schemata; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.9.2 + 3.2.9.3:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.9.2: Ensure that the table shows the relevant information for -# every database on which the current user or PUBLIC have -# privileges. -################################################################################ -# Testcase 3.2.9.3: Ensure that the table does not show any information on any -# databases on which the current user and PUBLIC have no -# privileges. -################################################################################ - -CREATE USER 'user_1'@'localhost'; -CREATE USER 'user_2'@'localhost'; -CREATE USER 'user_3'@'localhost'; - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict_1; -DROP DATABASE IF EXISTS db_datadict_2; ---enable_warnings - -CREATE DATABASE db_datadict_1; -CREATE DATABASE db_datadict_2; - -GRANT SELECT ON db_datadict_1.* to 'user_1'@'localhost'; -GRANT SELECT ON db_datadict_2.* to 'user_2'@'localhost'; - -FLUSH PRIVILEGES; - -# shows db_1 ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_9_1, localhost, user_1, , db_datadict_1); - -SELECT COUNT(*) FROM information_schema.schemata; -SELECT * FROM information_schema.schemata; -disconnect user_9_1; - - -# shows db_2 ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_9_2, localhost, user_2, , db_datadict_2); - -SELECT COUNT(*) FROM information_schema.schemata; -SELECT * FROM information_schema.schemata; -disconnect user_9_2; - - -# shows neither db_1 nor db_2 ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_9_3, localhost, user_3, , test); - -SELECT COUNT(*) FROM information_schema.schemata; -SELECT * FROM information_schema.schemata; -disconnect user_9_3; - - -# clean-up -connection default; ---source suite/funcs_1/include/show_connection.inc -DROP USER 'user_1'@'localhost'; -DROP USER 'user_2'@'localhost'; -DROP USER 'user_3'@'localhost'; -DROP DATABASE db_datadict_1; -DROP DATABASE db_datadict_2; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.10.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.10.1: Ensure that the INFORMATION_SCHEMA.TABLE_CONSTRAINTS -# table has the following columns, in the following order: -# -# CONSTRAINT_CATALOG (always shows NULL), -# CONSTRAINT_SCHEMA (shows the database, or schema, in which -# a constraint an accessible table resides), -# CONSTRAINT_NAME (shows the name of a constraint defined on -# an accessible table), -# TABLE_SCHEMA (shows the database, or schema, in which the -# table resides), -# TABLE_NAME (shows the name of the table), -# CONSTRAINT_TYPE (shows the type of the constraint; either -# 'primary key', 'foreign key', 'unique', 'check'). -################################################################################ - -let $is_table= table_constraints; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.10.2 + 3.2.10.3:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.10.2: Ensure that the table shows the relevant information on all -# constraints defined on every table for which the current -# user or PUBLIC have privileges. -################################################################################ -# Testcase 3.2.10.3: Ensure that the table does not show any information on -# constraints defined on any table for which the current user -# and PUBLIC have no privileges. -################################################################################ - -CREATE USER 'user_1'@'localhost'; -CREATE USER 'user_2'@'localhost'; - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; -DROP DATABASE IF EXISTS db_datadict_2; ---enable_warnings - -CREATE DATABASE db_datadict; -CREATE DATABASE db_datadict_2; - -USE db_datadict; - -CREATE TABLE res_6_401003_1(f1 INT NOT NULL, PRIMARY KEY(f1), f2 INT, INDEX f2_ind(f2)); - -USE db_datadict_2; - -CREATE TABLE res_6_401003_2(f1 INT NOT NULL, PRIMARY KEY(f1), f2 INT, INDEX f2_ind(f2)); - -GRANT SELECT ON db_datadict.res_6_401003_1 TO 'user_1'@'localhost'; -GRANT SELECT ON db_datadict_2.res_6_401003_2 TO 'user_2'@'localhost'; - -FLUSH PRIVILEGES; - - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_10_1, localhost, user_1, , db_datadict); - -SELECT * FROM information_schema.table_constraints; -SELECT COUNT(*) FROM information_schema.table_constraints; -disconnect user_10_1; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_10_2, localhost, user_2, , db_datadict_2); - -SELECT * FROM information_schema.table_constraints; -SELECT COUNT(*) FROM information_schema.table_constraints; -disconnect user_10_2; - -# clean-up -connection default; -use db_datadict; ---source suite/funcs_1/include/show_connection.inc -DROP USER 'user_1'@'localhost'; -DROP USER 'user_2'@'localhost'; -DROP TABLE res_6_401003_1; -USE db_datadict_2; -DROP TABLE res_6_401003_2; -USE test; -DROP DATABASE db_datadict; -DROP DATABASE db_datadict_2; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.11.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.11.1: Ensure that the INFORMATION_SCHEMA.TABLE_PRIVILEGES -# table has the following columns, in the following order: -# -# GRANTEE (shows the name of a user who has either granted, -# or been granted a table privilege), -# TABLE_CATALOG (always shows NULL), -# TABLE_SCHEMA (shows the name of the schema, or database, -# in which the table for which a privilege has been -# granted resides), -# TABLE_NAME (shows the name of the table), -# PRIVILEGE_TYPE (shows the type of privilege that was -# granted; must be either SELECT, INSERT, UPDATE, -# DELETE, REFERENCES, ALTER, INDEX, DROP, or CREATE -# VIEW), -# IS_GRANTABLE (shows whether that privilege was granted -# WITH GRANT OPTION). -################################################################################ - -let $is_table= table_privileges; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.11.2 + 3.2.11.3 + 3.2.11.4:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.11.2: Ensure that the table shows the relevant information on -# every table privilege which has been granted to the current -# user or PUBLIC, or which was granted by the current user. -################################################################################ -# Testcase 3.2.11.3: Ensure that the table does not show any information on any -# table privilege which was granted to any user other than -# the current user or PUBLIC, or which was granted by any -# user other than the current user. -################################################################################ -# Testcase 3.2.11.4: Ensure that the table does not show any information on any -# privileges that are not table privileges for the current -# user. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings - -create database db_datadict; - -CREATE USER 'user_1'@'localhost'; -GRANT CREATE, SELECT ON db_datadict.* TO 'user_1'@'localhost' WITH GRANT OPTION; -CREATE USER 'user_2'@'localhost'; -CREATE USER 'user_3'@'localhost'; - -use db_datadict; - -create table tb1(f1 int, f2 int, f3 int); - -grant select on db_datadict.tb1 to 'user_1'@'localhost'; -GRANT ALL on db_datadict.tb1 to 'user_2'@'localhost' WITH GRANT OPTION; - -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_11_1, localhost, user_1, , db_datadict); - -CREATE TABLE tb3 (f1 TEXT); -GRANT SELECT ON db_datadict.tb3 to 'user_3'@'localhost'; - -SELECT * FROM information_schema.table_privileges - WHERE table_name LIKE 'tb%'; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_11_2, localhost, user_2, , db_datadict); - -# we see only table privileges for this user, and not any other privileges -SELECT * FROM information_schema.table_privileges; - -SELECT USER(), COUNT(*) - FROM information_schema.table_privileges - WHERE grantee = USER(); - -SELECT USER(), COUNT(*) - FROM information_schema.table_privileges - WHERE grantee = "'user_2'@'localhost'"; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_11_3, localhost, user_3, , db_datadict); - -# we see only table privileges for this user, and not any other privileges -SELECT * FROM information_schema.table_privileges; - -connection default; ---source suite/funcs_1/include/show_connection.inc - -# we see only 'public' table privileges -SELECT * FROM information_schema.table_privileges; - -# clean-up -connection default; ---source suite/funcs_1/include/show_connection.inc -disconnect user_11_1; -disconnect user_11_2; -disconnect user_11_3; -DROP USER 'user_1'@'localhost'; -DROP USER 'user_2'@'localhost'; -DROP USER 'user_3'@'localhost'; -drop table db_datadict.tb1; -drop table db_datadict.tb3; -use test; -drop database db_datadict; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.12.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.12.1: Ensure that the INFORMATION_SCHEMA.TABLES -# table has the following columns, in the following order: -# -# TABLE_CATALOG (always shows NULL), -# TABLE_SCHEMA (shows the name of the database, or schema, -# in which an accessible table resides), -# TABLE_NAME (shows the name of a table which the current -# user may access), -# TABLE_TYPE (shows whether the table is a BASE TABLE, a -# TEMPORARY table, or a VIEW), -# ENGINE (shows the storage engine used for the table), -# VERSION (shows the version number of the table's .frm -# file), -# ROW_FORMAT (shows the table's row storage format; either -# FIXED, DYNAMIC or COMPRESSED), -# TABLE_ROWS (shows the number of rows in the table), -# AVG_ROW_LENGTH (shows the average length of the table's -# rows), -# DATA_LENGTH (shows the length of the table's data file), -# MAX_DATA_LENGTH (shows the maximum length of the table's -# data file), -# INDEX_LENGTH (shows the length of the index file -# associated with the table), -# DATA_FREE (shows the number of allocated, unused bytes), -# AUTO_INCREMENT (shows the next AUTO_INCREMENT value, where -# applicable), -# CREATE_TIME (shows the timestamp of the time the table was -# created), -# UPDATE_TIME (shows the timestamp of the time the table's -# data file was last updated), -# CHECK_TIME (shows the timestamp of the time the table was -# last checked), -# TABLE_COLLATION (shows the table's default collation), -# CHECKSUM (shows the live checksum value for the table, if -# any; otherwise NULL), -# CREATE_OPTIONS (shows any additional options used in the -# table's definition; otherwise NULL), -# TABLE_COMMENT (shows the comment added to the table's -# definition; otherwise NULL). -################################################################################ - -let $is_table= tables; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.12.2 + 3.2.12.3:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.12.2: Ensure that the table shows the relevant information on -# every base table and view on which the current user or -# PUBLIC has privileges. -################################################################################ -# Testcase 3.2.12.3: Ensure that the table does not show any information on any -# tables on which the current user and public have no -# privileges. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings - -create database db_datadict; - -CREATE USER 'user_1'@'localhost'; -GRANT CREATE, CREATE VIEW, INSERT, SELECT ON db_datadict.* - TO 'user_1'@'localhost' WITH GRANT OPTION; -CREATE USER 'user_2'@'localhost'; -CREATE USER 'user_3'@'localhost'; - -use db_datadict; - -create table tb1(f1 int, f2 int, f3 int); - -grant select on db_datadict.tb1 to 'user_1'@'localhost'; -GRANT ALL on db_datadict.tb1 to 'user_2'@'localhost' WITH GRANT OPTION; - -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_12_1, localhost, user_1, , db_datadict); - -# tb2 is not granted to anyone -CREATE TABLE tb2 (f1 DECIMAL); -CREATE TABLE tb3 (f1 TEXT); -GRANT SELECT ON db_datadict.tb3 to 'user_3'@'localhost'; -GRANT INSERT ON db_datadict.tb3 to 'user_2'@'localhost'; - -CREATE VIEW v3 AS SELECT * FROM tb3; -GRANT SELECT ON db_datadict.v3 to 'user_3'@'localhost'; - -#FIXME 3.2.12: we split the "SELECT * FROM tables" in two parts until -#FIXME 3.2.12: Bug #12397: wrong values shown in column CREATE_OPTIONS of -#FIXME 3.2.12: INFORMATION_SCHEMA.TABLES is solved, one with 'more' and one -#FIXME 3.2.12: with 'less' replace -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -# 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 17 CHECK_TIME -# 20 CREATE_OPTIONS -if ($have_bug_11589) -{ ---disable_ps_protocol -} ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" 20 "#CO#" -SELECT * FROM information_schema.tables - WHERE table_schema = 'information_schema'; -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -# 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 17 CHECK_TIME ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -SELECT * FROM information_schema.tables - WHERE NOT( table_schema = 'information_schema'); ---enable_ps_protocol - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_12_2, localhost, user_2, , db_datadict); - -# we see only tables for this user, and not any other -#FIXME 3.2.12: we split the "SELECT * FROM tables" in two parts until -#FIXME 3.2.12: Bug #12397: wrong values shown in column CREATE_OPTIONS of -#FIXME 3.2.12: INFORMATION_SCHEMA.TABLES is solved, one with 'more' and one -#FIXME 3.2.12: with 'less' replace -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -# 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 17 CHECK_TIME -# 20 CREATE_OPTIONS -if ($have_bug_11589) -{ ---disable_ps_protocol -} ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" 20 "#CO#" -SELECT * FROM information_schema.tables - WHERE table_schema = 'information_schema'; -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -# 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 17 CHECK_TIME ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -SELECT * FROM information_schema.tables - WHERE NOT( table_schema = 'information_schema'); ---enable_ps_protocol - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_12_3, localhost, user_3, , db_datadict); - -# we see only tables for this user, and not any other -# -#FIXME 3.2.12: we split the "SELECT * FROM tables" in two parts until -#FIXME 3.2.12: Bug #12397: wrong values shown in column CREATE_OPTIONS of -#FIXME 3.2.12: INFORMATION_SCHEMA.TABLES is solved, one with 'more' and one -#FIXME 3.2.12: with 'less' replace -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -# 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 17 CHECK_TIME -# 20 CREATE_OPTIONS -if ($have_bug_11589) -{ ---disable_ps_protocol -} ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" 20 "#CO#" -SELECT * FROM information_schema.tables - WHERE table_schema = 'information_schema'; -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -# 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 17 CHECK_TIME ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -SELECT * FROM information_schema.tables - WHERE NOT( table_schema = 'information_schema'); ---enable_ps_protocol - -connection default; ---source suite/funcs_1/include/show_connection.inc - -# we see only 'public' tables -# -#FIXME 3.2.12: we split the "SELECT * FROM tables" in two parts until -#FIXME 3.2.12: Bug #12397: wrong values shown in column CREATE_OPTIONS of -#FIXME 3.2.12: INFORMATION_SCHEMA.TABLES is solved, one with 'more' and one -#FIXME 3.2.12: with 'less' replace -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -# 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 17 CHECK_TIME -# 20 CREATE_OPTIONS -if ($have_bug_11589) -{ ---disable_ps_protocol -} ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" 20 "#CO#" -SELECT * FROM information_schema.tables - WHERE table_schema = 'information_schema'; -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -# 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 17 CHECK_TIME ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 17 "YYYY-MM-DD hh:mm:ss" -SELECT * FROM information_schema.tables - WHERE NOT( table_schema = 'information_schema') AND NOT (table_schema = 'mysql' AND table_name LIKE 'help_%'); ---enable_ps_protocol - -# clean-up -disconnect user_12_1; -disconnect user_12_2; -disconnect user_12_3; -DROP USER 'user_1'@'localhost'; -DROP USER 'user_2'@'localhost'; -DROP USER 'user_3'@'localhost'; -DROP TABLE db_datadict.tb1; -DROP TABLE db_datadict.tb3; -DROP VIEW db_datadict.v3; -USE test; -DROP DATABASE db_datadict; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.13.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.13.1: Ensure that the INFORMATION_SCHEMA.VIEWS -# table has the following columns, in the following order: -# -# TABLE_CATALOG (always shows NULL), -# TABLE_SCHEMA (shows the database, or schema, in which an -# accessible view resides), -# TABLE_NAME (shows the name of a view accessible to the -# current user), -# VIEW_DEFINITION (shows the SELECT statement that makes -# up the view's definition), -# CHECK_OPTION (shows the value of the WITH CHECK OPTION -# clause used to define the view, either NONE, LOCAL -# or CASCADED), -# IS_UPDATABLE (shows whether the view is an updatable -# view), -# DEFINER (added with 5.0.14), -# SECURITY_TYPE (added with 5.0.14). -################################################################################ - -let $is_table= views; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.13.2 + 3.2.13.3:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.13.2: Ensure that the table shows the relevant information on -# every view for which the current user or PUBLIC has the -# SHOW CREATE VIEW privilege. -################################################################################ -# Testcase 3.2.13.3: Ensure that the table does not show any information on any -# views for which the current user and PUBLIC have no SHOW -# CREATE VIEW privilege. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings - -CREATE DATABASE db_datadict; - -CREATE USER 'user_1'@'localhost'; -CREATE USER 'user_2'@'localhost'; -CREATE USER 'user_no_views'@'localhost'; -USE db_datadict; - -CREATE TABLE tb_401302(f1 INT, f2 INT, f3 INT); -CREATE VIEW v_granted_to_1 AS SELECT * FROM tb_401302; -CREATE VIEW v_granted_glob AS SELECT f2, f3 FROM tb_401302; - -GRANT SELECT ON db_datadict.tb_401302 TO 'user_1'@'localhost'; -GRANT SELECT ON db_datadict.v_granted_to_1 TO 'user_1'@'localhost'; -GRANT SHOW VIEW, CREATE VIEW ON db_datadict.* TO 'user_2'@'localhost'; - -FLUSH PRIVILEGES; - -SELECT * FROM information_schema.views; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_13_1, localhost, user_1, , test); - -SELECT * FROM information_schema.views; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_13_2, localhost, user_2, , test); - -SELECT * FROM information_schema.views; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_no_views, localhost, user_no_views, , test); - -SELECT * FROM information_schema.views; - -# clean-up -connection default; ---source suite/funcs_1/include/show_connection.inc -disconnect user_13_1; -disconnect user_13_2; -disconnect user_no_views; -USE db_datadict; -DROP USER 'user_1'@'localhost'; -DROP USER 'user_2'@'localhost'; -DROP USER 'user_no_views'@'localhost'; -DROP VIEW v_granted_to_1; -DROP TABLE tb_401302; -DROP VIEW v_granted_glob; -USE test; -DROP DATABASE db_datadict; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.14.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.14.1: Ensure that the INFORMATION_SCHEMA.STATISTICS -# table has the following columns, in the following order: -# -# TABLE_CATALOG (always shows NULL), -# TABLE_SCHEMA (shows the database, or schema, in which a -# table indexed by an accessible index resides), -# TABLE_NAME (shows the name of the indexed table), -# NON_UNIQUE (shows whether the index may contain duplicate -# values; 0 if it cannot, 1 if it can), -# INDEX_SCHEMA (shows the database, or schema, in which an -# accessible index resides), -# INDEX_NAME (shows the name of an index which the current -# user may access), -# SEQ_IN_INDEX (shows the ordinal position of an indexed -# column within the index), -# COLUMN_NAME (shows the name of a column that comprises -# some, or all, of an index key), -# COLLATION (shows how the column is sorted in the index; -# either A for ascending or NULL for unsorted -# columns), -# CARDINALITY (shows the number of unique values in the -# index), -# SUB_PART (shows the number of indexed characters if the -# index is a prefix index), -# PACKED (shows how the index key is packed), -# NULLABLE (shows whether the index column may contain NULL -# values), -# INDEX_TYPE (shows the index type; either BTREE, FULLTEXT, -# HASH or RTREE), -# COMMENT (shows a comment on the index, if any). -################################################################################ - -let $is_table= statistics; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.14.2 + 3.2.14.3:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.14.2: Ensure that the table shows the relevant information on -# every index which the current user or PUBLIC may access -# (usually because privileges on the indexed table have been -# granted). -################################################################################ -# Testcase 3.2.14.3: Ensure that the table does not show any information on any -# indexes which the current user and PUBLIC may not access. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; -DROP DATABASE IF EXISTS db_datadict_2; ---enable_warnings - -CREATE DATABASE db_datadict; -CREATE DATABASE db_datadict_2; - -CREATE USER 'user_1'@'localhost'; -CREATE USER 'user_2'@'localhost'; -USE db_datadict; - -create table tb_6_401402_1(f1 int not null, primary key(f1), f2 int, index f2_ind(f2)); -create table tb_6_401402_2(f1 int not null, primary key(f1), f2 int, index f2_ind(f2)); -grant select on db_datadict.tb_6_401402_1 to 'user_1'@'localhost' WITH GRANT OPTION; - -USE db_datadict_2; - -create table tb_2_1(f1 int not null, primary key(f1), f2 int, index f2_ind(f2)); -create table tb_2_2(f1 int not null, primary key(f1), f2 int, index f2_ind(f2)); -grant select on db_datadict_2.tb_2_1 to 'user_1'@'localhost'; - -FLUSH PRIVILEGES; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_14_1, localhost, user_1, , test); -SELECT * FROM information_schema.statistics; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_14_2, localhost, user_2, , test); -SELECT * FROM information_schema.statistics; - -connection default; ---source suite/funcs_1/include/show_connection.inc -REVOKE SELECT ON db_datadict.tb_6_401402_1 FROM 'user_1'@'localhost'; -SELECT * FROM information_schema.statistics -WHERE NOT (table_schema = 'mysql' AND table_name LIKE 'help_%'); - -# nothing visible for user_1 -connection user_14_1; ---source suite/funcs_1/include/show_connection.inc -SELECT * FROM information_schema.statistics; - -# no changes visible for user_2 -connection user_14_2; ---source suite/funcs_1/include/show_connection.inc -SELECT * FROM information_schema.statistics; - -# cleanup -connection default; ---source suite/funcs_1/include/show_connection.inc -disconnect user_14_1; -disconnect user_14_2; -USE db_datadict; -DROP USER 'user_1'@'localhost'; -DROP USER 'user_2'@'localhost'; -DROP TABLE tb_6_401402_1; -DROP TABLE tb_6_401402_2; -USE test; -DROP DATABASE db_datadict; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.15.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.15.1: Ensure that the INFORMATION_SCHEMA.SCHEMA_PRIVILEGES -# table has the following columns, in the following order: -# -# GRANTEE (shows a user to whom a schema privilege has been -# granted), -# TABLE_CATALOG (always shows NULL), -# TABLE_SCHEMA (shows the name of the database, or schema, -# on which the privilege has been granted), -# PRIVILEGE_TYPE (shows the granted privilege), -# IS_GRANTABLE (shows whether the privilege was granted WITH -# GRANT OPTION). -################################################################################ - -let $is_table= schema_privileges; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.15.2:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.15.2: Ensure that the table shows the relevant information on -# every schema-level privilege which has been granted to the -# current user or to PUBLIC, or has been granted by the -# current user. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; -DROP DATABASE IF EXISTS db_datadict_2; ---enable_warnings - -create database db_datadict; -create database db_datadict_2; - -CREATE USER 'u_6_401502'@'localhost'; - -use db_datadict; - -create table res_6_401502(f1 int, f2 int, f3 int); -grant insert on db_datadict.* to 'u_6_401502'@'localhost'; - -FLUSH PRIVILEGES; - -SELECT * FROM information_schema.schema_privileges; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u_6_401502, localhost, u_6_401502, , test); - -SELECT * FROM information_schema.schema_privileges; - -disconnect u_6_401502; - -# clean-up - -connection default; -use db_datadict; ---source suite/funcs_1/include/show_connection.inc -DROP USER 'u_6_401502'@'localhost'; -drop table res_6_401502; -use test; -drop database db_datadict; -drop database db_datadict_2; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.15.3 + 3.2.15.4:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.15.3: Ensure that the table does not show any information on any -# schema-level privileges which have been granted to users -# other than the current user or to PUBLIC, or that have been -# granted by any user other than the current user. -################################################################################ -# Testcase 3.2.15.4: Ensure that the table does not show any information on any -# privileges that are not schema-level privileges for the -# current user. -################################################################################ - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; -DROP DATABASE IF EXISTS db_datadict_2; ---enable_warnings - -create database db_datadict; -create database db_datadict_2; - -CREATE USER 'u_6_401503_1'@'localhost'; -CREATE USER 'u_6_401503_2'@'localhost'; -CREATE USER 'u_6_401503_3'@'localhost'; - -use db_datadict; - -create table res_6_401503_1(f1 int, f2 int, f3 int); - -use db_datadict_2; - -create table res_6_401503_2(f1 int, f2 int, f3 int); - -grant update on db_datadict.* to 'u_6_401503_1'@'localhost'; -grant delete on db_datadict_2.* to 'u_6_401503_2'@'localhost'; - -FLUSH PRIVILEGES; - -SELECT * FROM information_schema.schema_privileges; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u_6_401503_1, localhost, u_6_401503_1, , test); - -SELECT * FROM information_schema.schema_privileges; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u_6_401503_2, localhost, u_6_401503_2, , test); - -SELECT * FROM information_schema.schema_privileges; - -# should not show anything ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (u_6_401503_3, localhost, u_6_401503_3, , test); - -SELECT * FROM information_schema.schema_privileges; - -# clean-up - -connection default; ---source suite/funcs_1/include/show_connection.inc -disconnect u_6_401503_1; -disconnect u_6_401503_2; -disconnect u_6_401503_3; -use db_datadict; -DROP USER 'u_6_401503_1'@'localhost'; -DROP USER 'u_6_401503_2'@'localhost'; -DROP USER 'u_6_401503_3'@'localhost'; -drop table res_6_401503_1; -use db_datadict_2; -drop table res_6_401503_2; -use test; -drop database db_datadict; -drop database db_datadict_2; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.16.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.16.1: Ensure that the INFORMATION_SCHEMA.USER_PRIVILEGES -# table has the following columns, in the following order: -# -# GRANTEE (shows a user to whom a user privilege has been -# granted), -# TABLE_CATALOG (always shows NULL), -# PRIVILEGE_TYPE (shows the granted privilege), -# IS_GRANTABLE (shows whether the privilege was granted WITH -# GRANT OPTION). -################################################################################ - -#----------- -# Bug #12063 column 'TABLE_SCHEMA' is missing in table -# INFORMATION_SCHEMA.USER_PRIVILEGE -# ... is not a bug, it has been added by mistake in the TP requirement document. -#----------- - -let $is_table= user_privileges; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.16.2 + 3.2.16.3 + 3.2.16.4:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.16.2: Ensure that the table shows the relevant information on -# every user privilege which has been granted to the current -# user or to PUBLIC, or has been granted by the current user. -################################################################################ -# Testcase 3.2.16.3: Ensure that the table does not show any information on any -# user privileges which have been granted to users other than -# the current user or have been granted by any user other -# than the current user. -################################################################################ -# Testcase 3.2.16.4: Ensure that the table does not show any information on any -# privileges that are not user privileges for the current -# user. -################################################################################ - -#FIXME 3.2.16: - when Bug #12269 is fixed a some of the outputs here may be -#FIXME 3.2.16: deleted as I added them for checking where / which information -#FIXME 3.2.16: is shown. - ---disable_warnings -DROP DATABASE IF EXISTS db_datadict; ---enable_warnings - -let $cmd1= SELECT * FROM information_schema.user_privileges - WHERE grantee LIKE "%user%" - ORDER BY grantee, table_catalog, privilege_type; -let $cmd2= SELECT * FROM mysql.user WHERE user LIKE "%user%" ORDER BY host, user; -let $cmd3= SHOW GRANTS; - -CREATE DATABASE db_datadict; - -CREATE USER 'user_1'@'localhost'; -CREATE USER 'user_2'@'localhost'; -CREATE USER 'user_3'@'localhost'; - -GRANT SELECT ON db_datadict.* TO 'user_1'@'localhost'; -GRANT SELECT ON mysql.user TO 'user_1'@'localhost'; - -GRANT INSERT ON *.* TO 'user_2'@'localhost'; -GRANT UPDATE ON *.* TO 'user_2'@'localhost'; - -FLUSH PRIVILEGES; - -let $message= FIXME (see Bug 12269) Here we expect more than only for user_1; ---source include/show_msg.inc -eval $cmd1; -eval $cmd2; -eval $cmd3; - -let $message= add GRANT OPTION db_datadict.* to user_1; ---source include/show_msg.inc -GRANT UPDATE ON db_datadict.* TO 'user_1'@'localhost' WITH GRANT OPTION; - -let $message= FIXME (see Bug 12269) Here the is missing for the GRANT OPTION for user_1; ---source include/show_msg.inc -eval $cmd1; -eval $cmd2; -eval $cmd3; - -FLUSH PRIVILEGES; - - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_16_1, localhost, user_1, , db_datadict); -eval $cmd1; -eval $cmd2; -eval $cmd3; - -# add SELECT on *.* to user_1 -let $message= Now add SELECT on *.* to user_1; ---source include/show_msg.inc - -connection default; ---source suite/funcs_1/include/show_connection.inc -GRANT SELECT ON *.* TO 'user_1'@'localhost'; -let $message= Here is shown correctly for user_1; ---source include/show_msg.inc -eval $cmd1; -eval $cmd2; -eval $cmd3; - -FLUSH PRIVILEGES; -eval $cmd1; -eval $cmd2; -eval $cmd3; - -# check that this appears -connection user_16_1; ---source suite/funcs_1/include/show_connection.inc -eval $cmd1; -eval $cmd2; -eval $cmd3; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_16_2, localhost, user_2, , db_datadict); -eval $cmd1; ---error ER_TABLEACCESS_DENIED_ERROR -eval $cmd2; -eval $cmd3; - ---replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK -connect (user_16_3, localhost, user_3, , test); -eval $cmd1; ---error ER_TABLEACCESS_DENIED_ERROR -eval $cmd2; -eval $cmd3; - -let $message= revoke privileges from user_1; ---source include/show_msg.inc - -connection default; ---source suite/funcs_1/include/show_connection.inc -REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user_1'@'localhost'; -eval $cmd1; -eval $cmd2; -eval $cmd3; - -# check for changes -connection user_16_1; ---source suite/funcs_1/include/show_connection.inc -eval $cmd1; ---error ER_TABLEACCESS_DENIED_ERROR -eval $cmd2; -eval $cmd3; - ---source suite/funcs_1/include/show_connection.inc -# checks entered before bug #12269 was reported -# OK, user_1 has no privs here ---error ER_TABLEACCESS_DENIED_ERROR -CREATE TABLE db_datadict.tb_55 ( c1 TEXT ); ---source suite/funcs_1/include/show_connection.inc -eval $cmd1; ---error ER_TABLEACCESS_DENIED_ERROR -eval $cmd2; -eval $cmd3; -# OK, user_1 has no privs here ---error ER_TABLEACCESS_DENIED_ERROR -CREATE TABLE db_datadict.tb_66 ( c1 TEXT ); - -let $message= add ALL on db_datadict.* (and select on mysql.user) to user_1; ---source include/show_msg.inc - -connection default; ---source suite/funcs_1/include/show_connection.inc - -GRANT ALL ON db_datadict.* TO 'user_1'@'localhost' WITH GRANT OPTION; -GRANT SELECT ON mysql.user TO 'user_1'@'localhost'; -eval $cmd1; -eval $cmd2; -eval $cmd3; - -# check for changes -connection user_16_1; ---source suite/funcs_1/include/show_connection.inc -eval $cmd1; -eval $cmd2; -eval $cmd3; - -# OK, user_1 has no privs here ---error ER_TABLEACCESS_DENIED_ERROR -CREATE TABLE db_datadict.tb_56 ( c1 TEXT ); - -# using 'USE' lets the server read the privileges new, so now the CREATE works -USE db_datadict; ---source suite/funcs_1/include/show_connection.inc -eval $cmd1; -eval $cmd2; -eval $cmd3; -CREATE TABLE tb_57 ( c1 TEXT ); - -let $message= revoke privileges from user_1; ---source include/show_msg.inc - -connection default; ---source suite/funcs_1/include/show_connection.inc -REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user_1'@'localhost'; -FLUSH PRIVILEGES; -eval $cmd1; -eval $cmd2; -eval $cmd3; - -# check for changes -connection user_16_1; ---source suite/funcs_1/include/show_connection.inc -eval $cmd1; ---error ER_TABLEACCESS_DENIED_ERROR -eval $cmd2; -eval $cmd3; -# WORKS, as the existing old privileges are used! -CREATE TABLE db_datadict.tb_58 ( c1 TEXT ); -# existing privileges are "read" new when USE is called, user has no priviliges ---error ER_DBACCESS_DENIED_ERROR -USE db_datadict; -#FIXME 3.2.16: check that it is correct that this now 'works': --error 1142 -CREATE TABLE db_datadict.tb_59 ( c1 TEXT ); - - -# clean-up -connection default; ---source suite/funcs_1/include/show_connection.inc -disconnect user_16_1; -disconnect user_16_2; -disconnect user_16_3; -DROP USER 'user_1'@'localhost'; -DROP USER 'user_2'@'localhost'; -DROP USER 'user_3'@'localhost'; -DROP DATABASE IF EXISTS db_datadict; -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.17: Checks on Performance - not here in this script!; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.17.1: Ensure that every INFORMATION_SCHEMA table shows all the -# correct information, and no incorrect information, for a -# database to which 100 different users, each of which has a -# randomly issued set of privileges and access to a -# randomly chosen set of database objects, have access. -# The database should contain a mixture of all types of -# database objects (i.e. tables, views, stored procedures, -# triggers). -################################################################################ - -################################################################################ -# Testcase 3.2.17.2: Ensure that every INFORMATION_SCHEMA table shows all the -# correct information, and no incorrect information, for 10 -# different databases to which 50 different users, each of -# which has a randomly issued set of privileges and access -# to a randomly chosen set of database objects in two or -# more of the databases, have access. The databases should -# each contain a mixture of all types of database objects -# (i.e. tables, views, stored procedures, triggers). -################################################################################ - -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.18.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.18.1: Ensure that the INFORMATION_SCHEMA.TRIGGERS -# table has the following columns, in the following order: -# -# -# (FIXME - list copied from WL#1996) -# -# TRIGGER_CATALOG NULL -# TRIGGER_SCHEMA -# TRIGGER_NAME -# EVENT_MANIPULATION -# EVENT_OBJECT_CATALOG NULL -# EVENT_OBJECT_SCHEMA -# EVENT_OBJECT_TABLE -# ACTION_ORDER NULL -# ACTION_CONDITION NULL -# ACTION_STATEMENT -# ACTION_ORIENTATION -# ACTION_TIMING -# ACTION_REFERENCE_OLD_TABLE NULL -# ACTION_REFERENCE_NEW_TABLE NULL -# ACTION_REFERENCE_OLD_ROW -# ACTION_REFERENCE_NEW_ROW -# CREATED -# SQL_MODE -# -################################################################################ - -let $is_table= triggers; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.18.2 + 3.2.18.3:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.18.2: Ensure that the table shows the relevant information on -# every trigger on which the current user or PUBLIC has -# privileges. -################################################################################ -# Testcase 3.2.18.3: Ensure that the table does not show any information on any -# trigger on which the current user and public have no -# privileges. -################################################################################ - -#FIXME 3.2.18.2: to be added. -#FIXME 3.2.18.2: don't forget to add the test description to QATestPlanV50func - -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.19.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.19.1: Ensure that the INFORMATION_SCHEMA.PARAMETERS -# table has the following columns, in the following order: -# -################################################################################ - -let $is_table= parameters; -# when table is implemented remove this and the next 4 lines and "enable" 5th line: -# and don't forget to add the test description to QATestPlanV50func -let $message= checking a table that will be implemented later; ---source include/show_msg.inc ---error ER_UNKNOWN_TABLE -eval DESC $is_table; -#--source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - -let $message= Testcase 3.2.20.1:; ---source include/show_msg80.inc - -################################################################################ -# Testcase 3.2.20.1: Ensure that the INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS -# table has the following columns, in the following order: -# -################################################################################ - -let $is_table= referential_constraints; -# when table is implemented remove this and the next 4 lines and "enable" 5th line: -# and don't forget to add the test description to QATestPlanV50func -#let $message= checking a table that will be implemented later; -#--source include/show_msg.inc -#--error 1109 -eval DESC $is_table; ---source suite/funcs_1/datadict/datadict_show_table_design.inc -# ------------------------------------------------------------------------------------------------------- - - -################################################################################ -# -let $message= *** End of Data Dictionary Tests ***; ---source include/show_msg80.inc -# -################################################################################ - - -# some cleanup to be sure nothing remains ---disable_warnings -DROP TABLE IF EXISTS test.tb1; -DROP TABLE IF EXISTS test.tb2; -DROP TABLE IF EXISTS test.tb3; -DROP TABLE IF EXISTS test.tb4; -DROP TABLE IF EXISTS test.t1; -DROP TABLE IF EXISTS test.t2; -DROP TABLE IF EXISTS test.t3; -DROP TABLE IF EXISTS test.t4; -DROP TABLE IF EXISTS test.t7; -DROP TABLE IF EXISTS test.t8; -DROP TABLE IF EXISTS test.t9; -DROP TABLE IF EXISTS test.t10; -DROP TABLE IF EXISTS test.t11; -DROP DATABASE IF EXISTS test1; -DROP DATABASE IF EXISTS test4; -DROP DATABASE IF EXISTS db_datadict; -DROP DATABASE IF EXISTS db_datadict_1; -DROP DATABASE IF EXISTS db_datadict_2; ---enable_warnings diff --git a/mysql-test/suite/funcs_1/datadict/datadict_show_schema.inc b/mysql-test/suite/funcs_1/datadict/datadict_show_schema.inc deleted file mode 100644 index 35060cefbf8..00000000000 --- a/mysql-test/suite/funcs_1/datadict/datadict_show_schema.inc +++ /dev/null @@ -1,57 +0,0 @@ -#### suite/funcs_1/datadict/datadict_show_schema.test - -# shows content of tables from INFORMATION_SCHEMA - -# usage: - -# let $message= ; -# let $dbname= ; -# --source suite/funcs_1/datadict/datadict_show_schema.test - ---source include/show_msg.inc - -eval select * - from information_schema.schemata - where schema_name like '$dbname%'; - -eval select table_catalog, table_schema, engine - from information_schema.tables - where table_schema like '$dbname%'; - -eval select * - from information_schema.columns - where table_schema like '$dbname%'; - -eval select table_schema, table_name, is_updatable - from information_schema.views - where table_schema like '$dbname%'; - -eval select routine_name, routine_type, security_type, sql_mode - from information_schema.routines - where routine_schema like '$dbname%'; - -eval select table_name, index_schema, index_name, index_type - from information_schema.statistics - where table_schema like '$dbname%'; - ---replace_result $SERVER_NAME ---sorted_result -eval select * - from information_schema.user_privileges; -# where grantee="'u_6_401013'@'%'"; - -eval select * - from information_schema.column_privileges - where table_schema like '$dbname%'; - -eval select * - from information_schema.table_privileges - where table_schema like '$dbname%'; - -eval select * - from information_schema.key_column_usage - where table_schema like '$dbname%'; - -eval SELECT * - FROM information_schema.triggers - WHERE trigger_schema LIKE '$dbname%'; diff --git a/mysql-test/suite/funcs_1/datadict/datadict_show_table_design.inc b/mysql-test/suite/funcs_1/datadict/datadict_show_table_design.inc deleted file mode 100644 index e406d80f7f5..00000000000 --- a/mysql-test/suite/funcs_1/datadict/datadict_show_table_design.inc +++ /dev/null @@ -1,28 +0,0 @@ -#### suite/funcs_1/datadict/datadict_show_table_design.test -# -# - shows design of *one* table from INFORMATION_SCHEMA -# - used to have identical 'view' on all tested tables -# -# Usage: -# -# let $is_table= ; -# --source suite/funcs_1/datadict/datadict_show_table_design.test - -USE information_schema; - ---source suite/funcs_1/datadict/datadict_bug_12777.inc -eval DESC $is_table; - ---source suite/funcs_1/datadict/datadict_bug_12777.inc -eval SHOW CREATE TABLE $is_table; - -eval SELECT COUNT(*) FROM information_schema.columns -WHERE table_schema = 'information_schema' - AND table_name = '$is_table' -ORDER BY ordinal_position; - ---source suite/funcs_1/datadict/datadict_bug_12777.inc -eval SELECT * FROM information_schema.columns -WHERE table_schema = 'information_schema' - AND table_name = '$is_table' -ORDER BY ordinal_position; diff --git a/mysql-test/suite/funcs_1/datadict/datadict_tables.inc b/mysql-test/suite/funcs_1/datadict/datadict_tables.inc deleted file mode 100644 index 9712f0a9c1c..00000000000 --- a/mysql-test/suite/funcs_1/datadict/datadict_tables.inc +++ /dev/null @@ -1,62 +0,0 @@ -#### suite/funcs_1/datadict/datadict_tables.inc - -# contains all tables from INFORMATION_SCHEMA - -# usage: - -# --source suite/funcs_1/datadict/datadict_tables.inc - ---source include/show_msg.inc - -eval $dd_part1 schemata $dd_part2; - -#FIXME: splitting the "SELECT * FROM tables" in two parts until -#FIXME: Bug #12397: wrong values shown in column CREATE_OPTIONS of INFORMATION_SCHEMA.TABLES -#FIXME: is solved, like done in the _master.test, cannot be done here, so we replace here -#FIXME: the result for ALL rows. -# 9 AVG_ROW_LENGTH -# 10 DATA_LENGTH -# 11 MAX_DATA_LENGTH -## 12 INDEX_LENGTH -# 13 DATA_FREE -# 15 CREATE_TIME -# 16 UPDATE_TIME -# 20 CREATE_OPTIONS ---replace_column 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "YYYY-MM-DD hh:mm:ss" 16 "YYYY-MM-DD hh:mm:ss" 20 "#CO#" -eval $dd_part1 tables $dd_part2; - ---source suite/funcs_1/datadict/datadict_bug_12777.inc -eval $dd_part1 columns $dd_part2; -eval $dd_part1 character_sets $dd_part2; -eval $dd_part1 collations where collation_name <> 'utf8_general_cs' $dd_part2; -eval $dd_part1 collation_character_set_applicability where collation_name <> 'utf8_general_cs' $dd_part2; ---replace_column 16 17 -eval $dd_part1 routines $dd_part2; -eval $dd_part1 statistics $dd_part2; -eval $dd_part1 views $dd_part2; -eval $dd_part1 user_privileges $dd_part2; -eval $dd_part1 schema_privileges $dd_part2; -eval $dd_part1 table_privileges $dd_part2; -eval $dd_part1 column_privileges $dd_part2; -eval $dd_part1 table_constraints $dd_part2; -eval $dd_part1 key_column_usage $dd_part2; -eval $dd_part1 triggers $dd_part2; - -# later planned new tables for INFORMATION_SCHEMA (not before version 5.0.11) -# -# (see Reference Manual: 22.1.16. Other INFORMATION_SCHEMA Tables): -# -# parameters -# referential_constraints -# -# check them here although they currently does not exist, but using this we -# immedeatly get notice when they are implemented - -#### DON'T FORGET TO ADD THE NEW TABLES TO THE CORRESPONDING FILES -#### datadict_tables_error_.test ! - ---error 1109 -eval $dd_part1 parameters $dd_part2; - ---error 0,1109 -eval $dd_part1 referential_constraints $dd_part2; diff --git a/mysql-test/suite/funcs_1/datadict/datadict_tables_error.inc b/mysql-test/suite/funcs_1/datadict/datadict_tables_error.inc deleted file mode 100644 index a551266c447..00000000000 --- a/mysql-test/suite/funcs_1/datadict/datadict_tables_error.inc +++ /dev/null @@ -1,33 +0,0 @@ -#### suite/funcs_1/datadict/datadict_tables.inc - -# contains all tables from INFORMATION_SCHEMA - -# usage: - -# --source suite/funcs_1/datadict/datadict_tables.inc - - -#--disable_query_log -#eval SET @aux= 'This testcase shows the error number $error_no'; -#let $message= `SELECT @aux`; -#--enable_query_log ---source include/show_msg.inc - ---disable_abort_on_error -eval $dd_part1 schemata $dd_part2; -eval $dd_part1 tables $dd_part2; -eval $dd_part1 columns $dd_part2; -eval $dd_part1 character_sets $dd_part2; -eval $dd_part1 collations $dd_part2; -eval $dd_part1 collation_character_set_applicability $dd_part2; -eval $dd_part1 routines $dd_part2; -eval $dd_part1 statistics $dd_part2; -eval $dd_part1 views $dd_part2; -eval $dd_part1 user_privileges $dd_part2; -eval $dd_part1 schema_privileges $dd_part2; -eval $dd_part1 table_privileges $dd_part2; -eval $dd_part1 column_privileges $dd_part2; -eval $dd_part1 table_constraints $dd_part2; -eval $dd_part1 key_column_usage $dd_part2; -eval $dd_part1 triggers $dd_part2; ---enable_abort_on_error diff --git a/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1.inc b/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1.inc deleted file mode 100644 index d04459991cc..00000000000 --- a/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1.inc +++ /dev/null @@ -1,80 +0,0 @@ -#### suite/funcs_1/datadict/datadict_tables.inc - -# contains all tables from INFORMATION_SCHEMA - -# usage: - -# --source suite/funcs_1/datadict/datadict_tables_err_.inc -# -# up to a change of "mysqltest", which makes lines like "eval --error $err_no" -# possible we will have some different files with the same content except the -# error numbers. - ---source include/show_msg.inc - -let $message= known error 1 (Can_t create/write to file ...):; ---source include/show_msg.inc - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 schemata $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 tables $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 columns $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 character_sets $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 collations $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 collation_character_set_applicability $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 routines $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 statistics $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 views $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 user_privileges $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 schema_privileges $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 table_privileges $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 column_privileges $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 table_constraints $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 key_column_usage $dd_part2; - ---replace_result '\\' '/' ---error 1 -eval $dd_part1 triggers $dd_part2; diff --git a/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1044.inc b/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1044.inc deleted file mode 100755 index a8876ee7db6..00000000000 --- a/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1044.inc +++ /dev/null @@ -1,51 +0,0 @@ -#### suite/funcs_1/datadict/datadict_tables_error_1044.inc - -# contains all tables from INFORMATION_SCHEMA - -# usage: - -# --source suite/funcs_1/datadict/datadict_tables_err_.inc -# -# up to a change of "mysqltest", which makes lines like "eval --error $err_no" -# possible we will have some different files with the same content except the -# error numbers. - ---source include/show_msg.inc - -# e.g.: ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' - -let $message= known error 1044 (ERROR 42000: Access denied for user ... to database ...):; ---source include/show_msg.inc - ---error 1044 -eval $dd_part1 schemata $dd_part2; ---error 1044 -eval $dd_part1 tables $dd_part2; ---error 1044 -eval $dd_part1 columns $dd_part2; ---error 1044 -eval $dd_part1 character_sets $dd_part2; ---error 1044 -eval $dd_part1 collations $dd_part2; ---error 1044 -eval $dd_part1 collation_character_set_applicability $dd_part2; ---error 1044 -eval $dd_part1 routines $dd_part2; ---error 1044 -eval $dd_part1 statistics $dd_part2; ---error 1044 -eval $dd_part1 views $dd_part2; ---error 1044 -eval $dd_part1 user_privileges $dd_part2; ---error 1044 -eval $dd_part1 schema_privileges $dd_part2; ---error 1044 -eval $dd_part1 table_privileges $dd_part2; ---error 1044 -eval $dd_part1 column_privileges $dd_part2; ---error 1044 -eval $dd_part1 table_constraints $dd_part2; ---error 1044 -eval $dd_part1 key_column_usage $dd_part2; ---error 1044 -eval $dd_part1 triggers $dd_part2; diff --git a/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1049.inc b/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1049.inc deleted file mode 100644 index 4b12c836e92..00000000000 --- a/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1049.inc +++ /dev/null @@ -1,49 +0,0 @@ -#### suite/funcs_1/datadict/datadict_tables.inc - -# contains all tables from INFORMATION_SCHEMA - -# usage: - -# --source suite/funcs_1/datadict/datadict_tables_err_.inc -# -# up to a change of "mysqltest", which makes lines like "eval --error $err_no" -# possible we will have some different files with the same content except the -# error numbers. - ---source include/show_msg.inc - -let $message= known error 1049 (ERROR 42000: Unknown database ...):; ---source include/show_msg.inc - ---error 1049 -eval $dd_part1 schemata $dd_part2; ---error 1049 -eval $dd_part1 tables $dd_part2; ---error 1049 -eval $dd_part1 columns $dd_part2; ---error 1049 -eval $dd_part1 character_sets $dd_part2; ---error 1049 -eval $dd_part1 collations $dd_part2; ---error 1049 -eval $dd_part1 collation_character_set_applicability $dd_part2; ---error 1049 -eval $dd_part1 routines $dd_part2; ---error 1049 -eval $dd_part1 statistics $dd_part2; ---error 1049 -eval $dd_part1 views $dd_part2; ---error 1049 -eval $dd_part1 user_privileges $dd_part2; ---error 1049 -eval $dd_part1 schema_privileges $dd_part2; ---error 1049 -eval $dd_part1 table_privileges $dd_part2; ---error 1049 -eval $dd_part1 column_privileges $dd_part2; ---error 1049 -eval $dd_part1 table_constraints $dd_part2; ---error 1049 -eval $dd_part1 key_column_usage $dd_part2; ---error 1049 -eval $dd_part1 triggers $dd_part2; diff --git a/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1051.inc b/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1051.inc deleted file mode 100644 index 109b2ecd7da..00000000000 --- a/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1051.inc +++ /dev/null @@ -1,49 +0,0 @@ -#### suite/funcs_1/datadict/datadict_tables.inc - -# contains all tables from INFORMATION_SCHEMA - -# usage: - -# --source suite/funcs_1/datadict/datadict_tables_err_.inc -# -# up to a change of "mysqltest", which makes lines like "eval --error $err_no" -# possible we will have some different files with the same content except the -# error numbers. - ---source include/show_msg.inc - -let $message= known error 1051:; ---source include/show_msg.inc - ---error 1051 -eval $dd_part1 schemata $dd_part2; ---error 1051 -eval $dd_part1 tables $dd_part2; ---error 1051 -eval $dd_part1 columns $dd_part2; ---error 1051 -eval $dd_part1 character_sets $dd_part2; ---error 1051 -eval $dd_part1 collations $dd_part2; ---error 1051 -eval $dd_part1 collation_character_set_applicability $dd_part2; ---error 1051 -eval $dd_part1 routines $dd_part2; ---error 1051 -eval $dd_part1 statistics $dd_part2; ---error 1051 -eval $dd_part1 views $dd_part2; ---error 1051 -eval $dd_part1 user_privileges $dd_part2; ---error 1051 -eval $dd_part1 schema_privileges $dd_part2; ---error 1051 -eval $dd_part1 table_privileges $dd_part2; ---error 1051 -eval $dd_part1 column_privileges $dd_part2; ---error 1051 -eval $dd_part1 table_constraints $dd_part2; ---error 1051 -eval $dd_part1 key_column_usage $dd_part2; ---error 1051 -eval $dd_part1 triggers $dd_part2; diff --git a/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1146.inc b/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1146.inc deleted file mode 100644 index 5fa6d705b26..00000000000 --- a/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1146.inc +++ /dev/null @@ -1,49 +0,0 @@ -#### suite/funcs_1/datadict/datadict_tables.inc - -# contains all tables from INFORMATION_SCHEMA - -# usage: - -# --source suite/funcs_1/datadict/datadict_tables_err_.inc -# -# up to a change of "mysqltest", which makes lines like "eval --error $err_no" -# possible we will have some different files with the same content except the -# error numbers. - ---source include/show_msg.inc - -let $message= known error 1146:; ---source include/show_msg.inc - ---error 1146 -eval $dd_part1 schemata $dd_part2; ---error 1146 -eval $dd_part1 tables $dd_part2; ---error 1146 -eval $dd_part1 columns $dd_part2; ---error 1146 -eval $dd_part1 character_sets $dd_part2; ---error 1146 -eval $dd_part1 collations $dd_part2; ---error 1146 -eval $dd_part1 collation_character_set_applicability $dd_part2; ---error 1146 -eval $dd_part1 routines $dd_part2; ---error 1146 -eval $dd_part1 statistics $dd_part2; ---error 1146 -eval $dd_part1 views $dd_part2; ---error 1146 -eval $dd_part1 user_privileges $dd_part2; ---error 1146 -eval $dd_part1 schema_privileges $dd_part2; ---error 1146 -eval $dd_part1 table_privileges $dd_part2; ---error 1146 -eval $dd_part1 column_privileges $dd_part2; ---error 1146 -eval $dd_part1 table_constraints $dd_part2; ---error 1146 -eval $dd_part1 key_column_usage $dd_part2; ---error 1146 -eval $dd_part1 triggers $dd_part2; diff --git a/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1288.inc b/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1288.inc deleted file mode 100644 index e64226f0d35..00000000000 --- a/mysql-test/suite/funcs_1/datadict/datadict_tables_error_1288.inc +++ /dev/null @@ -1,49 +0,0 @@ -#### suite/funcs_1/datadict/datadict_tables.inc - -# contains all tables from INFORMATION_SCHEMA - -# usage: - -# --source suite/funcs_1/datadict/datadict_tables_err_.inc -# -# up to a change of "mysqltest", which makes lines like "eval --error $err_no" -# possible we will have some different files with the same content except the -# error numbers. - ---source include/show_msg.inc - -let $message= known error 1288:; ---source include/show_msg.inc - ---error 1288 -eval $dd_part1 schemata $dd_part2; ---error 1288 -eval $dd_part1 tables $dd_part2; ---error 1288 -eval $dd_part1 columns $dd_part2; ---error 1288 -eval $dd_part1 character_sets $dd_part2; ---error 1288 -eval $dd_part1 collations $dd_part2; ---error 1288 -eval $dd_part1 collation_character_set_applicability $dd_part2; ---error 1288 -eval $dd_part1 routines $dd_part2; ---error 1288 -eval $dd_part1 statistics $dd_part2; ---error 1288 -eval $dd_part1 views $dd_part2; ---error 1288 -eval $dd_part1 user_privileges $dd_part2; ---error 1288 -eval $dd_part1 schema_privileges $dd_part2; ---error 1288 -eval $dd_part1 table_privileges $dd_part2; ---error 1288 -eval $dd_part1 column_privileges $dd_part2; ---error 1288 -eval $dd_part1 table_constraints $dd_part2; ---error 1288 -eval $dd_part1 key_column_usage $dd_part2; ---error 1288 -eval $dd_part1 triggers $dd_part2; diff --git a/mysql-test/suite/funcs_1/datadict/is_table_query.inc b/mysql-test/suite/funcs_1/datadict/is_table_query.inc new file mode 100644 index 00000000000..3ed7413167a --- /dev/null +++ b/mysql-test/suite/funcs_1/datadict/is_table_query.inc @@ -0,0 +1,42 @@ +# suite/funcs_1/datadict/is_table_query.inc +# +# Check that every INFORMATION_SCHEMA table can be queried with a SELECT +# statement, just as if it were an ordinary user-defined table. +# (Requirement 3.2.1.1) +# +# The variable $is_table must be set before sourcing this script. +# +# Author: +# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of +# testsuite funcs_1 +# Create this script based on older scripts and new code. +# +--disable_warnings +DROP VIEW IF EXISTS test.v1; +DROP PROCEDURE IF EXISTS test.p1; +DROP FUNCTION IF EXISTS test.f1; +--enable_warnings +eval CREATE VIEW test.v1 AS SELECT * FROM information_schema.$is_table; +eval CREATE PROCEDURE test.p1() SELECT * FROM information_schema.$is_table; +delimiter //; +eval CREATE FUNCTION test.f1() returns BIGINT +BEGIN + DECLARE counter BIGINT DEFAULT NULL; + SELECT COUNT(*) INTO counter FROM information_schema.$is_table; + RETURN counter; +END// +delimiter ;// + + +# We are not interested to check the content here. +--echo # Attention: The printing of the next result sets is disabled. +--disable_result_log +eval SELECT * FROM information_schema.$is_table; +SELECT * FROM test.v1; +CALL test.p1; +SELECT test.f1(); +--enable_result_log + +DROP VIEW test.v1; +DROP PROCEDURE test.p1; +DROP FUNCTION test.f1; diff --git a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc index 337ddf5df60..24df7ef8948 100644 --- a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc +++ b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc @@ -112,11 +112,11 @@ connect (con100,localhost,ddicttestuser1,ddictpass,information_schema); --echo #################################################################################### connection default; eval SHOW CREATE TABLE $table; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME eval SHOW $table; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME eval SELECT * FROM $table $select_where ORDER BY id; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME eval SELECT $columns FROM $table $select_where ORDER BY id; --source suite/funcs_1/datadict/datadict_priv.inc --real_sleep 0.3 @@ -128,11 +128,11 @@ connection con100; --echo SHOW/SELECT shows only the processes (1) of the user. --echo #################################################################################### eval SHOW CREATE TABLE $table; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME eval SHOW $table; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME eval SELECT * FROM $table $select_where ORDER BY id; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME eval SELECT $columns FROM $table $select_where ORDER BY id; --source suite/funcs_1/datadict/datadict_priv.inc --real_sleep 0.3 @@ -154,9 +154,9 @@ GRANT PROCESS ON *.* TO ddicttestuser1@'localhost' IDENTIFIED BY 'ddictpass'; --echo #################################################################################### connection con100; SHOW GRANTS; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SHOW processlist; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -166,9 +166,9 @@ SELECT * FROM information_schema.processlist; --echo #################################################################################### connect (con101,localhost,ddicttestuser1,ddictpass,information_schema); SHOW GRANTS; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SHOW processlist; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -188,9 +188,9 @@ GRANT PROCESS ON *.* TO ''@'localhost'; --echo #################################################################################### connect (anonymous1,localhost,'',,information_schema); SHOW GRANTS; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SHOW processlist; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -210,9 +210,9 @@ connect (con102,localhost,ddicttestuser1,ddictpass,information_schema); --echo ddicttestuser1 are visible. --echo #################################################################################### SHOW GRANTS; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SHOW processlist; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -235,10 +235,10 @@ SHOW GRANTS FOR ''@'localhost'; if ($fixed_bug_30395) { # Bug#30395 strange results after REVOKE PROCESS ON *.* FROM ... ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SHOW processlist; } ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -257,9 +257,9 @@ connect (con103,localhost,ddicttestuser1,ddictpass,information_schema); --echo Only the processes of ddicttestuser1 user are visible. --echo #################################################################################### SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SHOW processlist; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -279,9 +279,9 @@ connect (con104,localhost,ddicttestuser1,ddictpass,information_schema); --echo Only the processes of ddicttestuser1 are visible. --echo #################################################################################### SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SHOW processlist; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -326,9 +326,9 @@ connect (con200,localhost,ddicttestuser2,ddictpass,information_schema); --echo ddicttestuser2 has now the PROCESS privilege and sees all connections --echo #################################################################################### SHOW GRANTS FOR 'ddicttestuser2'@'localhost'; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SHOW processlist; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -347,9 +347,9 @@ connect (con201,localhost,ddicttestuser2,ddictpass,information_schema); --echo ddicttestuser2 has no more the PROCESS privilege and can only see own connects --echo #################################################################################### SHOW GRANTS; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SHOW processlist; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -370,9 +370,9 @@ connect (con107,localhost,ddicttestuser1,ddictpass,information_schema); SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; --error ER_ACCESS_DENIED_ERROR GRANT PROCESS ON *.* TO 'ddicttestuser2'@'localhost'; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SHOW processlist; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SELECT * FROM information_schema.processlist; --real_sleep 0.3 @@ -394,9 +394,9 @@ connect (con108,localhost,ddicttestuser1,ddictpass,information_schema); --echo Therefore the missing SELECT privilege does not affect SELECTs on PROCESSLIST. --echo #################################################################################### SHOW GRANTS FOR 'ddicttestuser1'@'localhost'; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SHOW processlist; ---replace_column 6 TIME +--replace_column 1 ID 6 TIME SELECT * FROM information_schema.processlist; --real_sleep 0.3 diff --git a/mysql-test/suite/funcs_1/datadict/processlist_val.inc b/mysql-test/suite/funcs_1/datadict/processlist_val.inc index 62e5d95f875..69a32553f65 100644 --- a/mysql-test/suite/funcs_1/datadict/processlist_val.inc +++ b/mysql-test/suite/funcs_1/datadict/processlist_val.inc @@ -2,7 +2,7 @@ # # # Testing of values within INFORMATION_SCHEMA.PROCESSLIST # # # -# Ensure that the values fit to the current state of the connection # +# Ensure that the values fit to the current event of the connection # # and especially that they change if a connection does nothing or # # runs some SQL. # # Examples: # @@ -32,7 +32,9 @@ # Creation: # # 2007-08-09 mleich Implement this test as part of # # WL#3982 Test information_schema.processlist # -# # +# 2008-01-05 HHunger Changed time test and long statement test. # +# It could happen that the long statement test # +# fail due to timing problems. # # # ######################################################################## # Basic preparations @@ -108,29 +110,22 @@ connection default; # - State IS NULL # - INFO must be empty # -let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST +let $wait_condition= SELECT id,user,host,db,command,@time:=time,state,info FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND = 'Sleep' AND TIME > 0; --source include/wait_condition.inc # -# Expect to hit TIME = 1. ---replace_column 1 -SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; -# Change the SQL command (affects content of INFO) ---replace_column 1 -SHOW FULL PROCESSLIST; +# Expect to hit TIME > 1. +SELECT @time > 0; # --echo # Sleep some time # The value of TIME must increase and reach 2 after some sleeps. -let $wait_timeout= 2; -let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST - WHERE TIME > 1; +let $wait_timeout= 4; +let $wait_condition= SELECT id,user,host,db,command,@time2:=time,state,info FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE TIME > @time; --source include/wait_condition.inc # -# Expect to hit TIME = 2. ---replace_column 1 -SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; ---replace_column 1 -SHOW FULL PROCESSLIST; +# Expect to hit TIME > @time +SELECT @time < @time2; # # # The second connection must have an ID = my ID + 1; @@ -201,28 +196,22 @@ connection default; --echo # Sleep some time # The command must be after some time in work by the server. # So poll till INFO is no more NULL and TIME > 0. -let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST +let $wait_condition= SELECT id,user,host,db,command,@time:=time,state,info FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO IS NOT NULL AND TIME > 0; --source include/wait_condition.inc # -# Expect to see TIME = 1 ---replace_column 1 -SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; ---replace_column 1 -SHOW FULL PROCESSLIST; +# Expect to see TIME > 0; +SELECT @time > 0; # --echo # Sleep some time # The value of TIME must increase and reach 2 after some sleeps. let $wait_timeout= 2; -let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST - WHERE TIME > 1; +let $wait_condition= SELECT id,user,host,db,command,@time2:=time,state,info FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE TIME > @time; --source include/wait_condition.inc # -# Expect to see TIME = 2 ---replace_column 1 -SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST; ---replace_column 1 -SHOW FULL PROCESSLIST; +# Expect to see @time < @time2 +SELECT @time < @time2; # --echo --echo ----- switch to connection ddicttestuser1 (user = ddicttestuser1) ----- @@ -247,19 +236,20 @@ connection default; --echo # Sleep some time # The command must be after some time in work by the server. # There is a short phase with STATE IS NULL followed by a longer phase -# with STATE = 'init'. -# So poll till INFO is no more NULL AND STATE = 'init'. +# with STATE = 'executing'. +# So poll till INFO is no more NULL AND STATE = 'executing'. +let $wait_timeout= 9; let $wait_condition= SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST - WHERE INFO IS NOT NULL AND STATE = 'init'; + WHERE INFO IS NOT NULL AND STATE = 'executing'; --source include/wait_condition.inc # # Expect to see that SELECT/SHOW PROCESSLIST can handle my statement monster. ---replace_column 1 6