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/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/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/myisam.result b/mysql-test/r/myisam.result index 1c8b5e9d7d9..bf57b6e1006 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -2023,4 +2023,185 @@ 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; End of 5.1 tests diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index a361a8f6bcc..a571708dea8 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1,4 +1,7 @@ drop table if exists t1; +create table t1 (a int) partition by list ((a/3)*10 div 1) +(partition p0 values in (0), partition p1 values in (1)); +ERROR HY000: This partition function is not allowed CREATE TABLE t1 ( d DATE NOT NULL ) @@ -44,15 +47,6 @@ partition by key(a) partitions 1e+300; ERROR 42000: Only integers allowed as number here near '1e+300' at line 3 create table t1 (a int) -partition by key (a) -(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); -ERROR 42000: Incorrect table name 'part-data' -create table t1 (a int) -partition by key (a) -(partition p0, -partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); -ERROR 42000: Incorrect table name 'part-data' -create table t1 (a int) partition by list (a) (partition p0 values in (1)); create procedure pz() @@ -1207,25 +1201,6 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified' id 22589 drop table t1, t2; -set @org_mode=@@sql_mode; -set @@sql_mode='NO_DIR_IN_CREATE'; -select @@sql_mode; -@@sql_mode -NO_DIR_IN_CREATE -create table t1 (i int ) -partition by range (i) -( -partition p01 values less than (1000) -data directory='/not/existing' - index directory='/not/existing' -); -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `i` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (i) (PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */ -DROP TABLE t1, t2; -set @@sql_mode=@org_mode; create table t1 (c1 varchar(255),c2 tinyint,primary key(c1)) partition by key (c1) partitions 10 ; insert into t1 values ('aaa','1') on duplicate key update c2 = c2 + 1; diff --git a/mysql-test/r/partition_datatype.result b/mysql-test/r/partition_datatype.result index c6506178b03..43c65f23e61 100644 --- a/mysql-test/r/partition_datatype.result +++ b/mysql-test/r/partition_datatype.result @@ -1,4 +1,11 @@ drop table if exists t1; +# test with not null +create table t1 (a bit not null) partition by key (a); +insert into t1 values (b'1'); +select hex(a) from t1 where a = b'1'; +hex(a) +1 +drop table t1; create table t1 (a tinyint not null) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; @@ -30,22 +37,22 @@ a 2 drop table t1; create table t1 (a float not null) partition by key (a); -insert into t1 values (2.1); -select * from t1 where a = 2.1; +insert into t1 values (0.5); +select * from t1 where a = 0.5; a +0.5 drop table t1; create table t1 (a double not null) partition by key (a); -insert into t1 values (2.1); -select * from t1 where a = 2.1; +insert into t1 values (0.5); +select * from t1 where a = 0.5; a -2.1 +0.5 drop table t1; -create table t1 (a decimal not null) partition by key (a); +create table t1 (a decimal(4,2) not null) partition by key (a); insert into t1 values (2.1); -Warnings: -Note 1265 Data truncated for column 'a' at row 1 select * from t1 where a = 2.1; a +2.10 drop table t1; create table t1 (a date not null) partition by key (a); insert into t1 values ('2001-01-01'); @@ -125,6 +132,13 @@ select * from t1 where a = 'y'; a y drop table t1; +# test with null allowed +create table t1 (a bit) partition by key (a); +insert into t1 values (b'1'); +select hex(a) from t1 where a = b'1'; +hex(a) +1 +drop table t1; create table t1 (a tinyint) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; @@ -156,22 +170,22 @@ a 2 drop table t1; create table t1 (a float) partition by key (a); -insert into t1 values (2.1); -select * from t1 where a = 2.1; +insert into t1 values (0.5); +select * from t1 where a = 0.5; a +0.5 drop table t1; create table t1 (a double) partition by key (a); -insert into t1 values (2.1); -select * from t1 where a = 2.1; +insert into t1 values (0.5); +select * from t1 where a = 0.5; a -2.1 +0.5 drop table t1; -create table t1 (a decimal) partition by key (a); +create table t1 (a decimal(4,2)) partition by key (a); insert into t1 values (2.1); -Warnings: -Note 1265 Data truncated for column 'a' at row 1 select * from t1 where a = 2.1; a +2.10 drop table t1; create table t1 (a date) partition by key (a); insert into t1 values ('2001-01-01'); @@ -254,25 +268,41 @@ drop table t1; create table t1 (a varchar(65531)) partition by key (a); insert into t1 values ('bbbb'); insert into t1 values ('aaaa'); -select * from t1 where a = 'aaa%'; +select * from t1 where a = 'aaaa'; a +aaaa select * from t1 where a like 'aaa%'; a aaaa +select * from t1 where a = 'bbbb'; +a +bbbb drop table t1; create table t1 (a varchar(65532)) partition by key (a); insert into t1 values ('bbbb'); insert into t1 values ('aaaa'); -select * from t1 where a = 'aaa%'; +select * from t1 where a = 'aaaa'; a +aaaa select * from t1 where a like 'aaa%'; a aaaa +select * from t1 where a = 'bbbb'; +a +bbbb drop table t1; create table t1 (a varchar(65533) not null) partition by key (a); +insert into t1 values ('bbbb'); insert into t1 values ('aaaa'); -select * from t1 where a = 'aaa%'; +select * from t1 where a = 'aaaa'; a +aaaa +select * from t1 where a like 'aaa%'; +a +aaaa +select * from t1 where a = 'bbbb'; +a +bbbb drop table t1; create table t1 (a varchar(65533)) partition by key (a); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs @@ -280,3 +310,17 @@ create table t1 (a varchar(65534) not null) partition by key (a); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs create table t1 (a varchar(65535)) partition by key (a); ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs +create table t1 (a bit(27), primary key (a)) engine=myisam +partition by hash (a) +(partition p0, partition p1, partition p2); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` bit(27) NOT NULL DEFAULT '\0\0\0\0', + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM, PARTITION p2 ENGINE = MyISAM) */ +insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34); +select hex(a) from t1 where a = 7; +hex(a) +7 +drop table t1; diff --git a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result index 4c6459a09e3..b027ef088ae 100644 --- a/mysql-test/r/partition_range.result +++ b/mysql-test/r/partition_range.result @@ -1,4 +1,15 @@ drop table if exists t1, t2; +create table t1 (a int) +partition by range (a) +( partition p0 values less than (maxvalue)); +alter table t1 add partition (partition p1 values less than (100000)); +ERROR HY000: MAXVALUE can only be used in last partition definition +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ +drop table t1; create table t1 (a integer) partition by range (a) ( partition p0 values less than (4), diff --git a/mysql-test/r/partition_symlink.result b/mysql-test/r/partition_symlink.result index 20e841d2e0e..8b55124d7eb 100644 --- a/mysql-test/r/partition_symlink.result +++ b/mysql-test/r/partition_symlink.result @@ -81,3 +81,34 @@ Got one of the listed errors DROP DATABASE mysqltest2; USE test; DROP USER mysqltest_1@localhost; +set @org_mode=@@sql_mode; +set @@sql_mode='NO_DIR_IN_CREATE'; +select @@sql_mode; +@@sql_mode +NO_DIR_IN_CREATE +create table t1 (i int ) +partition by range (i) +( +partition p01 values less than (1000) +data directory='/not/existing' + index directory='/not/existing' +); +Warnings: +Warning 0 DATA DIRECTORY option ignored +Warning 0 INDEX DIRECTORY option ignored +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `i` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (i) (PARTITION p01 VALUES LESS THAN (1000) ENGINE = MyISAM) */ +DROP TABLE t1, t2; +set @@sql_mode=@org_mode; +create table t1 (a int) +partition by key (a) +(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); +ERROR 42000: Incorrect table name 'part-data' +create table t1 (a int) +partition by key (a) +(partition p0, +partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); +ERROR 42000: Incorrect table name 'part-data' diff --git a/mysql-test/r/partition_windows.result b/mysql-test/r/partition_windows.result index 1fc9e2ba254..c2d4054deeb 100644 --- a/mysql-test/r/partition_windows.result +++ b/mysql-test/r/partition_windows.result @@ -1,14 +1,30 @@ -DROP TABLE IF EXISTS `example`; -CREATE TABLE `example` ( -`ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT, -`DESCRIPTION` varchar(30) NOT NULL, -`LEVEL` smallint(5) unsigned DEFAULT NULL, -PRIMARY KEY (`ID_EXAMPLE`) +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +c1 int(10) unsigned NOT NULL AUTO_INCREMENT, +c2 varchar(30) NOT NULL, +c3 smallint(5) unsigned DEFAULT NULL, +PRIMARY KEY (c1) ) ENGINE = MYISAM -PARTITION BY HASH(ID_EXAMPLE)( -PARTITION p0 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p0Data', -PARTITION p1 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p1Data', -PARTITION p2 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p2Data', -PARTITION p3 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p3Data' +PARTITION BY HASH(c1)( +PARTITION p0 +DATA DIRECTORY = 'C:/mysqltest/p0Data' + INDEX DIRECTORY = 'D:/mysqltest/p0Index', +PARTITION p1, +PARTITION p2 +DATA DIRECTORY = 'E:/mysqltest/p2Data' + INDEX DIRECTORY = 'F:/mysqltest/p2Index' ); -ERROR HY000: Can't create/write to file 'C:\build\5.1\data\partitiontest\p0Data\example#P#p0.MYD' (Errcode: 2) +Warnings: +Warning 0 DATA DIRECTORY option ignored +Warning 0 INDEX DIRECTORY option ignored +Warning 0 DATA DIRECTORY option ignored +Warning 0 INDEX DIRECTORY option ignored +INSERT INTO t1 VALUES (NULL, "first", 1); +INSERT INTO t1 VALUES (NULL, "second", 2); +INSERT INTO t1 VALUES (NULL, "third", 3); +ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index'); +Warnings: +Warning 0 DATA DIRECTORY option ignored +Warning 0 INDEX DIRECTORY option ignored +INSERT INTO t1 VALUES (NULL, "last", 4); +DROP TABLE t1; diff --git a/mysql-test/r/plugin_load.result b/mysql-test/r/plugin_load.result new file mode 100644 index 00000000000..33116cc20ab --- /dev/null +++ b/mysql-test/r/plugin_load.result @@ -0,0 +1,3 @@ +SELECT @@global.example_enum_var = 'e2'; +@@global.example_enum_var = 'e2' +1 diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index 4eece9d5b5a..7599d80588a 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -162,3 +162,11 @@ DROP DATABASE db1; DROP DATABASE db2; USE test; End of 5.0 tests +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/suite/parts/inc/partition_basic.inc b/mysql-test/suite/parts/inc/partition_basic.inc index a5815d3b71c..35b016d5ab2 100644 --- a/mysql-test/suite/parts/inc/partition_basic.inc +++ b/mysql-test/suite/parts/inc/partition_basic.inc @@ -30,29 +30,6 @@ let $unique= ; --source suite/parts/inc/partition_methods1.inc # - --echo # 1.1.1 with DATA DIECTORY/INDEX DIRECTORY - # - --disable_query_log - # DATA DIRECTORY - # Make directory for partition data - --exec mkdir $MYSQLTEST_VARDIR/master-data/test/data || true - eval SET @data_dir = 'DATA DIRECTORY = - ''''$MYSQLTEST_VARDIR/master-data/test/data'''''; - let $data_directory = `select @data_dir`; - - #INDEX DIRECTORY - # Make directory for partition index - --exec mkdir $MYSQLTEST_VARDIR/master-data/test/index || true - eval SET @indx_dir = 'INDEX DIRECTORY = - ''''$MYSQLTEST_VARDIR/master-data/test/index'''''; - let $index_directory = `select @indx_dir`; - - let $with_directories= 1; - --source suite/parts/inc/partition_methods1.inc - --source suite/parts/inc/partition_directory.inc - let $with_directories= 0; - --enable_query_log - # --echo # 1.2 The partitioning function contains two columns. let $unique= ; --source suite/parts/inc/partition_methods2.inc @@ -72,28 +49,6 @@ if ($more_pk_ui_tests) --echo # 2.2 UNIQUE INDEX consisting of one column let $unique= , UNIQUE INDEX uidx1 (f_int1); --source suite/parts/inc/partition_methods1.inc - - --echo # 2.2.1 with DATA DIECTORY/INDEX DIRECTORY - # - --disable_query_log - # DATA DIRECTORY - # Make directory for partition data - --exec mkdir $MYSQLTEST_VARDIR/master-data/test/data || true - eval SET @data_dir = 'DATA DIRECTORY = - ''''$MYSQLTEST_VARDIR/master-data/test/data'''''; - let $data_directory = `select @data_dir`; - - #INDEX DIRECTORY - # Make directory for partition index - --exec mkdir $MYSQLTEST_VARDIR/master-data/test/index || true - eval SET @indx_dir = 'INDEX DIRECTORY = - ''''$MYSQLTEST_VARDIR/master-data/test/index'''''; - let $index_directory = `select @indx_dir`; - - let $with_directories= TRUE; - --source suite/parts/inc/partition_methods1.inc - let $with_directories= FALSE; - --enable_query_log # if ($do_pk_tests) { diff --git a/mysql-test/suite/parts/inc/partition_basic_symlink.inc b/mysql-test/suite/parts/inc/partition_basic_symlink.inc new file mode 100644 index 00000000000..22a61477388 --- /dev/null +++ b/mysql-test/suite/parts/inc/partition_basic_symlink.inc @@ -0,0 +1,159 @@ +################################################################################ +# inc/partition_basic_symlink.inc # +# # +# Purpose: # +# Basic tests around create partitioned table with/without PRIMARY KEY and # +# /or UNIQUE INDEX # +# Also includes test for DATA/INDEX DIR which requires symlinked files # +# # +#------------------------------------------------------------------------------# +# Original Author: mleich # +# Original Date: 2006-03-05 # +# Change Author: mattiasj # +# Change Date: 2008-02-06 # +# Change: copied it from partition_basic.inc and kept DATA/INDEX DIR # +################################################################################ +--enable_abort_on_error + +--echo +--echo #======================================================================== +--echo # Check partitioning methods on just created tables +--echo # The tables should be defined without/with PRIMARY KEY and +--echo # UNIQUE INDEXes. +--echo # Every test round has to check +--echo # PARTITION BY HASH/KEY/LIST/RANGE +--echo # PARTITION BY RANGE/LIST ... SUBPARTITION BY HASH/KEY ... +--echo #======================================================================== +--echo #------------------------------------------------------------------------ +--echo # 1 Tables without PRIMARY KEY or UNIQUE INDEXes +--echo #------------------------------------------------------------------------ +--echo # 1.1 The partitioning function contains one column. +let $unique= ; +--source suite/parts/inc/partition_methods1.inc +# + --echo # 1.1.1 with DATA DIECTORY/INDEX DIRECTORY + # + --disable_query_log + # DATA DIRECTORY + # Make directory for partition data + --exec mkdir $MYSQLTEST_VARDIR/master-data/test/data || true + eval SET @data_dir = 'DATA DIRECTORY = + ''''$MYSQLTEST_VARDIR/master-data/test/data'''''; + let $data_directory = `select @data_dir`; + + #INDEX DIRECTORY + # Make directory for partition index + --exec mkdir $MYSQLTEST_VARDIR/master-data/test/index || true + eval SET @indx_dir = 'INDEX DIRECTORY = + ''''$MYSQLTEST_VARDIR/master-data/test/index'''''; + let $index_directory = `select @indx_dir`; + + let $with_directories= 1; + --source suite/parts/inc/partition_methods1.inc + --source suite/parts/inc/partition_directory.inc + let $with_directories= 0; + --enable_query_log + # +--echo # 1.2 The partitioning function contains two columns. +let $unique= ; +--source suite/parts/inc/partition_methods2.inc +# +--echo #------------------------------------------------------------------------ +--echo # 2 Tables with PRIMARY KEY and/or UNIQUE INDEXes +--echo # The partitioning function contains one column. +--echo #------------------------------------------------------------------------ +if ($more_pk_ui_tests) +{ + if ($do_pk_tests) + { + --echo # 2.1 PRIMARY KEY consisting of one column + let $unique= , PRIMARY KEY(f_int1); + --source suite/parts/inc/partition_methods1.inc + } + --echo # 2.2 UNIQUE INDEX consisting of one column + let $unique= , UNIQUE INDEX uidx1 (f_int1); + --source suite/parts/inc/partition_methods1.inc + + --echo # 2.2.1 with DATA DIECTORY/INDEX DIRECTORY + # + --disable_query_log + # DATA DIRECTORY + # Make directory for partition data + --exec mkdir $MYSQLTEST_VARDIR/master-data/test/data || true + eval SET @data_dir = 'DATA DIRECTORY = + ''''$MYSQLTEST_VARDIR/master-data/test/data'''''; + let $data_directory = `select @data_dir`; + + #INDEX DIRECTORY + # Make directory for partition index + --exec mkdir $MYSQLTEST_VARDIR/master-data/test/index || true + eval SET @indx_dir = 'INDEX DIRECTORY = + ''''$MYSQLTEST_VARDIR/master-data/test/index'''''; + let $index_directory = `select @indx_dir`; + + let $with_directories= TRUE; + --source suite/parts/inc/partition_methods1.inc + let $with_directories= FALSE; + --enable_query_log + # + if ($do_pk_tests) + { + --echo # 2.3 PRIMARY KEY consisting of two columns + let $unique= , PRIMARY KEY(f_int1,f_int2); + --source suite/parts/inc/partition_methods1.inc + let $unique= , PRIMARY KEY(f_int2,f_int1); + --source suite/parts/inc/partition_methods1.inc + } + # + --echo # 2.4 UNIQUE INDEX consisting of two columns + let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2); + --source suite/parts/inc/partition_methods1.inc + let $unique= , UNIQUE INDEX uidx1 (f_int2,f_int1); + --source suite/parts/inc/partition_methods1.inc + # +} +--echo # 2.5 PRIMARY KEY + UNIQUE INDEX consisting of two columns +if ($do_pk_tests) +{ + let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2), PRIMARY KEY(f_int2,f_int1); + --source suite/parts/inc/partition_methods1.inc + let $unique= , UNIQUE INDEX uidx1 (f_int2,f_int1), PRIMARY KEY(f_int1,f_int2); + --source suite/parts/inc/partition_methods1.inc +} +let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1); +--source suite/parts/inc/partition_methods1.inc + +--echo #------------------------------------------------------------------------ +--echo # 3 Tables with PRIMARY KEY and/or UNIQUE INDEXes +--echo # The partitioning function contains two columns. +--echo #------------------------------------------------------------------------ +# +if ($more_pk_ui_tests) +{ + if ($do_pk_tests) + { + --echo # 3.1 PRIMARY KEY consisting of two columns + let $unique= , PRIMARY KEY(f_int1,f_int2); + --source suite/parts/inc/partition_methods2.inc + + let $unique= , PRIMARY KEY(f_int2,f_int1); + --source suite/parts/inc/partition_methods2.inc + } + # + --echo # 3.2 UNIQUE INDEX consisting of two columns + let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2); + --source suite/parts/inc/partition_methods2.inc + let $unique= , UNIQUE INDEX uidx1 (f_int2,f_int1); + --source suite/parts/inc/partition_methods2.inc +} +# +--echo # 3.3 PRIMARY KEY and UNIQUE INDEX consisting of two columns +if ($do_pk_tests) +{ + let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2), PRIMARY KEY(f_int2,f_int1); + --source suite/parts/inc/partition_methods2.inc + let $unique= , UNIQUE INDEX uidx1 (f_int2,f_int1), PRIMARY KEY(f_int1,f_int2); + --source suite/parts/inc/partition_methods2.inc +} +let $unique= , UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1); +--source suite/parts/inc/partition_methods2.inc diff --git a/mysql-test/suite/parts/inc/partition_bigint.inc b/mysql-test/suite/parts/inc/partition_bigint.inc index f7d22ce17d1..d3cd55096e7 100644 --- a/mysql-test/suite/parts/inc/partition_bigint.inc +++ b/mysql-test/suite/parts/inc/partition_bigint.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a bigint unsigned not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_binary.inc b/mysql-test/suite/parts/inc/partition_binary.inc index 3ee363927c4..68e9e56e29e 100644 --- a/mysql-test/suite/parts/inc/partition_binary.inc +++ b/mysql-test/suite/parts/inc/partition_binary.inc @@ -1,23 +1,11 @@ --echo ---- Partitioning and binary data type ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a binary(255) not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64)); select hex(a) from t1; diff --git a/mysql-test/suite/parts/inc/partition_bit.inc b/mysql-test/suite/parts/inc/partition_bit.inc index 6fcf3b208bb..5bbf0058028 100644 --- a/mysql-test/suite/parts/inc/partition_bit.inc +++ b/mysql-test/suite/parts/inc/partition_bit.inc @@ -1,15 +1,3 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - --disable_warnings drop table if exists t1; --enable_warnings @@ -23,8 +11,8 @@ drop table t1; eval create table t1 (a bit(0), primary key (a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory, -partition pa2 $data_directory $index_directory); +partition pa1, +partition pa2); show create table t1; drop table t1; @@ -37,15 +25,16 @@ insert into t1 values (b'0000000000000000000000000000000000000000000000000000000000000001'), (b'1010101010101010101010101010101010101010101010101010101010101010'), (b'0101010101010101010101010101010101010101010101010101010101010101'); +--sorted_result select hex(a) from t1; drop table t1; eval create table t1 (a bit(64), primary key (a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (b'1111111111111111111111111111111111111111111111111111111111111111'), @@ -55,6 +44,7 @@ insert into t1 values (b'0101010101010101010101010101010101010101010101010101010101010101'); select hex(a) from t1 where a=b'0101010101010101010101010101010101010101010101010101010101010101'; delete from t1 where a=b'0101010101010101010101010101010101010101010101010101010101010101'; +--sorted_result select hex(a) from t1; drop table t1; @@ -62,12 +52,15 @@ eval create table t2 (a bit, primary key (a)) engine=$engine partition by key (a) partitions 4; show create table t2; insert into t2 values (b'0'), (b'1'); +--sorted_result select hex(a) from t2; alter table t2 drop primary key; show create table t2; +--sorted_result select hex(a) from t2; alter table t2 add primary key (a); show create table t2; +--sorted_result select hex(a) from t2; drop table t2; @@ -90,6 +83,7 @@ dec $count; select hex(a) from t3 where a=b'01010101'; delete from t3 where a=b'01010101'; select count(*) from t3; +--sorted_result select hex(a) from t3; drop table t3; @@ -111,5 +105,6 @@ dec $count; select hex(a) from t4 where a=b'00000001'; delete from t4 where a=b'00000001'; select count(*) from t4; +--sorted_result select hex(a) from t4; drop table t4; diff --git a/mysql-test/suite/parts/inc/partition_blob.inc b/mysql-test/suite/parts/inc/partition_blob.inc index b22693c9f3d..0c3ec3fc9ba 100644 --- a/mysql-test/suite/parts/inc/partition_blob.inc +++ b/mysql-test/suite/parts/inc/partition_blob.inc @@ -1,24 +1,12 @@ --echo ---- Partitioning and blob data type ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - --error ER_BLOB_FIELD_IN_PART_FUNC_ERROR eval create table t1 (a blob not null, primary key(a(767))) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); #show create table t1; #insert into t1 values (repeat('a',1000)), ('b'), (repeat('a',500)), (repeat('b',64)); diff --git a/mysql-test/suite/parts/inc/partition_char.inc b/mysql-test/suite/parts/inc/partition_char.inc index b3d7ae3c2a1..1db9642c002 100644 --- a/mysql-test/suite/parts/inc/partition_char.inc +++ b/mysql-test/suite/parts/inc/partition_char.inc @@ -1,23 +1,11 @@ --echo ---- Partitioning and char data type ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a char(255) not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64)); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_date.inc b/mysql-test/suite/parts/inc/partition_date.inc index 45f9012604c..b538a5a9d8b 100644 --- a/mysql-test/suite/parts/inc/partition_date.inc +++ b/mysql-test/suite/parts/inc/partition_date.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a date not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values ('1975-01-01'), ('2020-12-31'), ('1980-10-14'), ('2000-06-15'); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_datetime.inc b/mysql-test/suite/parts/inc/partition_datetime.inc index e948e827b4e..b9b277a0fcc 100644 --- a/mysql-test/suite/parts/inc/partition_datetime.inc +++ b/mysql-test/suite/parts/inc/partition_datetime.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a datetime not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59'); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_decimal.inc b/mysql-test/suite/parts/inc/partition_decimal.inc index 09eb9b10831..17cef08e275 100644 --- a/mysql-test/suite/parts/inc/partition_decimal.inc +++ b/mysql-test/suite/parts/inc/partition_decimal.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a decimal(10,4) not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (999999.9999), (-999999.9999), (123456.7899), (-123456.7899), (-1.5), (1), (0), (-1), (1.5), (1234.567), (-1234.567); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_double.inc b/mysql-test/suite/parts/inc/partition_double.inc index 57be826bac7..befbe860b86 100644 --- a/mysql-test/suite/parts/inc/partition_double.inc +++ b/mysql-test/suite/parts/inc/partition_double.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a double not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_enum.inc b/mysql-test/suite/parts/inc/partition_enum.inc index 886ab6a5f97..9f2c5976097 100644 --- a/mysql-test/suite/parts/inc/partition_enum.inc +++ b/mysql-test/suite/parts/inc/partition_enum.inc @@ -1,23 +1,11 @@ --echo ---- Partitioning and enum data type ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a enum('A','B','C','D','E','F','G','H','I','J','K','L') not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values ('A'),('D'),('L'),('G'); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_float.inc b/mysql-test/suite/parts/inc/partition_float.inc index 45c2f16ac98..34f14137d4d 100644 --- a/mysql-test/suite/parts/inc/partition_float.inc +++ b/mysql-test/suite/parts/inc/partition_float.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a float not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (-3.402823466E+38), (3.402823466E+38), (-1.5), (-1), (0), (1), (1.5); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_int.inc b/mysql-test/suite/parts/inc/partition_int.inc index 7f019c96b94..bd9da689187 100644 --- a/mysql-test/suite/parts/inc/partition_int.inc +++ b/mysql-test/suite/parts/inc/partition_int.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a int unsigned not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (4294967295), (4294967294), (4294967293), (4294967292), (1), (2), (65535); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_key_16col.inc b/mysql-test/suite/parts/inc/partition_key_16col.inc index 5f97d5d0f71..988dc4554ab 100644 --- a/mysql-test/suite/parts/inc/partition_key_16col.inc +++ b/mysql-test/suite/parts/inc/partition_key_16col.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine=$engine partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), diff --git a/mysql-test/suite/parts/inc/partition_key_32col.inc b/mysql-test/suite/parts/inc/partition_key_32col.inc index 90a36d2a228..614693902dc 100644 --- a/mysql-test/suite/parts/inc/partition_key_32col.inc +++ b/mysql-test/suite/parts/inc/partition_key_32col.inc @@ -1,29 +1,17 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - --error ER_TOO_MANY_KEY_PARTS eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3)) engine=$engine partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine=$engine partition by key(a,b,c,d,e,f,g,h) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); --disable_abort_on error show create table t1; diff --git a/mysql-test/suite/parts/inc/partition_key_4col.inc b/mysql-test/suite/parts/inc/partition_key_4col.inc index c5d1452080f..a94ab581620 100644 --- a/mysql-test/suite/parts/inc/partition_key_4col.inc +++ b/mysql-test/suite/parts/inc/partition_key_4col.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w'), primary key(a,b,c,d)) engine=$engine partition by key (a,b,c,d) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values ('1975-01-01', 'abcde', 'abcde','m'), diff --git a/mysql-test/suite/parts/inc/partition_key_8col.inc b/mysql-test/suite/parts/inc/partition_key_8col.inc index a0d2e1532f3..fcbab7c355d 100644 --- a/mysql-test/suite/parts/inc/partition_key_8col.inc +++ b/mysql-test/suite/parts/inc/partition_key_8col.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h)) engine=$engine partition by key(a,b,c,d,e,f,g,h) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), diff --git a/mysql-test/suite/parts/inc/partition_mediumint.inc b/mysql-test/suite/parts/inc/partition_mediumint.inc index 18bfedf7ed9..10ed96e52b0 100644 --- a/mysql-test/suite/parts/inc/partition_mediumint.inc +++ b/mysql-test/suite/parts/inc/partition_mediumint.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a mediumint unsigned not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_set.inc b/mysql-test/suite/parts/inc/partition_set.inc index b9501ad04b6..8b8c3c9ddf5 100644 --- a/mysql-test/suite/parts/inc/partition_set.inc +++ b/mysql-test/suite/parts/inc/partition_set.inc @@ -1,23 +1,11 @@ --echo ---- Partitioning and set data type ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a set('A','B','C','D','E','F','G','H','I','J','K','L') not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values ('A,B'),('C,D'),('E,L'),('G,H,K'); select * from t1 order by a; diff --git a/mysql-test/suite/parts/inc/partition_smallint.inc b/mysql-test/suite/parts/inc/partition_smallint.inc index c594cd4c26c..8e5e93f079b 100644 --- a/mysql-test/suite/parts/inc/partition_smallint.inc +++ b/mysql-test/suite/parts/inc/partition_smallint.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a smallint unsigned not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_text.inc b/mysql-test/suite/parts/inc/partition_text.inc index 761f5dfb118..f766027773d 100644 --- a/mysql-test/suite/parts/inc/partition_text.inc +++ b/mysql-test/suite/parts/inc/partition_text.inc @@ -1,24 +1,12 @@ --echo ---- Partitioning and text data type ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - --error ER_BLOB_FIELD_IN_PART_FUNC_ERROR eval create table t1 (a text not null, primary key(a(767))) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); #show create table t1; #insert into t1 values (repeat('a',1000)), ('b'), (repeat('a',500)), (repeat('b',64)); diff --git a/mysql-test/suite/parts/inc/partition_time.inc b/mysql-test/suite/parts/inc/partition_time.inc index a3f49a156fe..008963ed934 100644 --- a/mysql-test/suite/parts/inc/partition_time.inc +++ b/mysql-test/suite/parts/inc/partition_time.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a time not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values ('21:21:21'), ('12:10:30'), ('03:03:03'), ('23:59'); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_timestamp.inc b/mysql-test/suite/parts/inc/partition_timestamp.inc index d4b1699d6c5..d152c82a76f 100644 --- a/mysql-test/suite/parts/inc/partition_timestamp.inc +++ b/mysql-test/suite/parts/inc/partition_timestamp.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a timestamp not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59'); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_tinyint.inc b/mysql-test/suite/parts/inc/partition_tinyint.inc index a1f8874e794..00568eec244 100644 --- a/mysql-test/suite/parts/inc/partition_tinyint.inc +++ b/mysql-test/suite/parts/inc/partition_tinyint.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a tinyint unsigned not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (255), (254), (253), (252), (1), (2), (128); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_varbinary.inc b/mysql-test/suite/parts/inc/partition_varbinary.inc index 48fd6d890d8..02d9f68f1a2 100644 --- a/mysql-test/suite/parts/inc/partition_varbinary.inc +++ b/mysql-test/suite/parts/inc/partition_varbinary.inc @@ -1,23 +1,11 @@ --echo ---- Partitioning and varbinary data type ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a varbinary(767) not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (repeat('a',767)), ('b'), (repeat('a',500)), (repeat('b',64)); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_varchar.inc b/mysql-test/suite/parts/inc/partition_varchar.inc index c018a16e919..f1412d3aae5 100644 --- a/mysql-test/suite/parts/inc/partition_varchar.inc +++ b/mysql-test/suite/parts/inc/partition_varchar.inc @@ -1,23 +1,11 @@ --echo ---- Partitioning and varchar data type ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a varchar(767) not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values (repeat('a',767)), ('b'), (repeat('a',500)), (repeat('b',64)); select * from t1; diff --git a/mysql-test/suite/parts/inc/partition_year.inc b/mysql-test/suite/parts/inc/partition_year.inc index 2643380702e..5fb46c1756b 100644 --- a/mysql-test/suite/parts/inc/partition_year.inc +++ b/mysql-test/suite/parts/inc/partition_year.inc @@ -1,21 +1,9 @@ ---disable_query_log -# DATA DIRECTORY -eval SET @data_dir = 'DATA DIRECTORY = -''/tmp'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -eval SET @indx_dir = 'INDEX DIRECTORY = -''/tmp'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - eval create table t1 (a year not null, primary key(a)) engine=$engine partition by key (a) ( -partition pa1 $data_directory $index_directory max_rows=20 min_rows=2, -partition pa2 $data_directory $index_directory max_rows=30 min_rows=3, -partition pa3 $data_directory $index_directory max_rows=30 min_rows=4, -partition pa4 $data_directory $index_directory max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; insert into t1 values ('1975'), (2020), ('1980'), ('2000'); select * from t1; diff --git a/mysql-test/suite/parts/r/partition_basic_innodb.result b/mysql-test/suite/parts/r/partition_basic_innodb.result index b9097e33ce0..894a57b2357 100644 --- a/mysql-test/suite/parts/r/partition_basic_innodb.result +++ b/mysql-test/suite/parts/r/partition_basic_innodb.result @@ -3597,6675 +3597,6 @@ test.t1 repair note The storage engine for the table doesn't support repair # check layout success: 1 TRUNCATE t1; -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -# 1.1.1 with DATA DIECTORY/INDEX DIRECTORY -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; -ERROR HY000: Table has no partition for value 2147483647 -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; -ERROR HY000: Table has no partition for value 2147483647 -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -DROP TABLE IF EXISTS t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, PARTITION part0 VALUES IN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; -ERROR HY000: Table has no partition for value 2147483647 -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart22 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, SUBPARTITION subpart42 ENGINE = InnoDB)) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; -ERROR HY000: Table has no partition for value 2147483647 -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# Attention: There are unused files. -# Either the DROP TABLE or a preceding ALTER TABLE -# worked incomplete. -# We found: -unified filelist ---- not determined --- -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp12 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be able to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair note The storage engine for the table doesn't support repair -# check layout success: 1 -TRUNCATE t1; - # check TRUNCATE success: 1 # check layout success: 1 # End usability test (inc/partition_check.inc) @@ -14878,7 +8209,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) ENGINE = InnoDB, PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15360,7 +8691,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -15840,7 +9171,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16322,7 +9653,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = InnoDB, SUBPARTITION subpart22 ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = InnoDB, SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, SUBPARTITION subpart42 ENGINE = InnoDB)) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -16802,7 +10133,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, SUBPARTITION sp12 ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = InnoDB, SUBPARTITION sp22 ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = InnoDB, SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, SUBPARTITION sp42 ENGINE = InnoDB)) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -17284,7 +10615,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int2`,`f_int1`), UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -18731,7 +12062,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) ENGINE = InnoDB, PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19213,7 +12544,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -19693,7 +13024,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -20175,7 +13506,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = InnoDB, SUBPARTITION subpart22 ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = InnoDB, SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, SUBPARTITION subpart42 ENGINE = InnoDB)) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -20655,7 +13986,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, SUBPARTITION sp12 ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = InnoDB, SUBPARTITION sp22 ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = InnoDB, SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, SUBPARTITION sp42 ENGINE = InnoDB)) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -21137,7 +14468,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, PRIMARY KEY (`f_int1`,`f_int2`), UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -22616,7 +15947,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) ENGINE = InnoDB, PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -23114,7 +16445,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -23610,7 +16941,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -24108,7 +17439,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = InnoDB, SUBPARTITION subpart22 ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = InnoDB, SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, SUBPARTITION subpart42 ENGINE = InnoDB)) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -24604,7 +17935,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, SUBPARTITION sp12 ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = InnoDB, SUBPARTITION sp22 ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = InnoDB, SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, SUBPARTITION sp42 ENGINE = InnoDB)) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 @@ -25102,7 +18433,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ # check prerequisites-1 success: 1 # check COUNT(*) success: 1 diff --git a/mysql-test/suite/parts/r/partition_basic_myisam.result b/mysql-test/suite/parts/r/partition_basic_myisam.result index 7e0d5bcd62a..120db1274af 100644 --- a/mysql-test/suite/parts/r/partition_basic_myisam.result +++ b/mysql-test/suite/parts/r/partition_basic_myisam.result @@ -3711,7125 +3711,6 @@ test.t1 repair status OK # check layout success: 1 TRUNCATE t1; -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -# 1.1.1 with DATA DIECTORY/INDEX DIRECTORY -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI -# check layout success: 0 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI -# check layout success: 0 -TRUNCATE t1; - -# check TRUNCATE success: 1 -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI -# check layout success: 0 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p3.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p4.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p5.MYD -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p3.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p4.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p5.MYI - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p5.MYI -# check layout success: 0 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p5.MYI -# check layout success: 0 -TRUNCATE t1; - -# check TRUNCATE success: 1 -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p5.MYI -# check layout success: 0 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part0.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_1.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_2.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_3.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_N.MYD -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part0.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_1.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_2.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_3.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_N.MYI - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_N.MYI -# check layout success: 0 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_N.MYI -# check layout success: 0 -TRUNCATE t1; - -# check TRUNCATE success: 1 -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_N.MYI -# check layout success: 0 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#parte.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partf.MYD -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#parte.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partf.MYI - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; -ERROR HY000: Table has no partition for value 2147483647 -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partf.MYI -# check layout success: 0 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partf.MYI -# check layout success: 0 -TRUNCATE t1; - -# check TRUNCATE success: 1 -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partf.MYI -# check layout success: 0 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp0.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp1.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp0.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp1.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp0.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp1.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp0.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp1.MYD -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp0.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp1.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp0.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp1.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp0.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp1.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp0.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp1.MYI - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp1.MYI -# check layout success: 0 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp1.MYI -# check layout success: 0 -TRUNCATE t1; - -# check TRUNCATE success: 1 -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp1.MYI -# check layout success: 0 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart11.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart12.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart21.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart22.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart31.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart32.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart41.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart42.MYD -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart11.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart12.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart21.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart22.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart31.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart32.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart41.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart42.MYI - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; -ERROR HY000: Table has no partition for value 2147483647 -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart42.MYI -# check layout success: 0 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart42.MYI -# check layout success: 0 -TRUNCATE t1; - -# check TRUNCATE success: 1 -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart42.MYI -# check layout success: 0 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp11.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp12.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp21.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp22.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp31.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp32.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp41.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp42.MYD -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp11.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp12.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp21.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp22.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp31.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp32.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp41.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp42.MYI - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp42.MYI -# check layout success: 0 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp42.MYI -# check layout success: 0 -TRUNCATE t1; - -# check TRUNCATE success: 1 -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp42.MYI -# check layout success: 0 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp0.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp1.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp2.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp0.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp1.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp2.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp0.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp1.MYD -$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp2.MYD -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp0.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp1.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp2.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp0.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp1.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp2.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp0.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp1.MYI -$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp2.MYI - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp2.MYI -# check layout success: 0 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp2.MYI -# check layout success: 0 -TRUNCATE t1; - -# check TRUNCATE success: 1 -state new -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par -state old -Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ -File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp2.MYI -# check layout success: 0 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -DROP TABLE IF EXISTS t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; -ERROR HY000: Table has no partition for value 2147483647 -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, SUBPARTITION subpart42 ENGINE = MyISAM)) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; -ERROR HY000: Table has no partition for value 2147483647 -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -# check layout success: 1 -TRUNCATE t1; - -# check TRUNCATE success: 1 -# check layout success: 1 -# End usability test (inc/partition_check.inc) -DROP TABLE t1; -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; -# Start usability test (inc/partition_check.inc) -create_command -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `f_int1` int(11) DEFAULT NULL, - `f_int2` int(11) DEFAULT NULL, - `f_char1` char(20) DEFAULT NULL, - `f_char2` char(20) DEFAULT NULL, - `f_charbig` varchar(1000) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ - -unified filelist -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD -$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI -$MYSQLTEST_VARDIR/master-data/test/t1.frm -$MYSQLTEST_VARDIR/master-data/test/t1.par - -# check prerequisites-1 success: 1 -# check COUNT(*) success: 1 -# check MIN/MAX(f_int1) success: 1 -# check MIN/MAX(f_int2) success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'delete me' FROM t0_template -WHERE f_int1 IN (2,3); -# check prerequisites-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'delete me'; -# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE -# check read via f_int1 success: 1 -# check read via f_int2 success: 1 - -# check multiple-1 success: 1 -DELETE FROM t1 WHERE MOD(f_int1,3) = 0; - -# check multiple-2 success: 1 -INSERT INTO t1 SELECT * FROM t0_template -WHERE MOD(f_int1,3) = 0; - -# check multiple-3 success: 1 -UPDATE t1 SET f_int1 = f_int1 + @max_row -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 -AND @max_row_div2 + @max_row_div4; - -# check multiple-4 success: 1 -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row -AND @max_row_div2 + @max_row_div4 + @max_row; - -# check multiple-5 success: 1 -SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-1 success: 1 -SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; -INSERT INTO t1 -SET f_int1 = @cur_value , f_int2 = @cur_value, -f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), -f_charbig = '#SINGLE#'; - -# check single-2 success: 1 -SELECT MIN(f_int1) INTO @cur_value1 FROM t1; -SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value2 -WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; - -# check single-3 success: 1 -SET @cur_value1= -1; -SELECT MAX(f_int1) INTO @cur_value2 FROM t1; -UPDATE t1 SET f_int1 = @cur_value1 -WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; - -# check single-4 success: 1 -SELECT MAX(f_int1) INTO @cur_value FROM t1; -DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; - -# check single-5 success: 1 -DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; - -# check single-6 success: 1 -INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; - -# check single-7 success: 1 -DELETE FROM t1 WHERE f_charbig = '#2147483647##'; -DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; -INSERT t1 SET f_int1 = 0 , f_int2 = 0, -f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), -f_charbig = '#NULL#'; -INSERT INTO t1 -SET f_int1 = NULL , f_int2 = -@max_row, -f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), -f_charbig = '#NULL#'; -# check null success: 1 - -# check null-1 success: 1 -UPDATE t1 SET f_int1 = -@max_row -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-2 success: 1 -UPDATE t1 SET f_int1 = NULL -WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-3 success: 1 -DELETE FROM t1 -WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) -AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; - -# check null-4 success: 1 -DELETE FROM t1 -WHERE f_int1 = 0 AND f_int2 = 0 -AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) -AND f_charbig = '#NULL#'; -SET AUTOCOMMIT= 0; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-1 success: 1 -COMMIT WORK; - -# check transactions-2 success: 1 -ROLLBACK WORK; - -# check transactions-3 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -ROLLBACK WORK; - -# check transactions-4 success: 1 -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, '', '', 'was inserted' -FROM t0_template source_tab -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; - -# check transactions-5 success: 1 -ROLLBACK WORK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back - -# check transactions-6 success: 1 -# INFO: Storage engine used for t1 seems to be not transactional. -COMMIT; - -# check transactions-7 success: 1 -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -SET @@session.sql_mode = 'traditional'; -SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, -'', '', 'was inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; -ERROR 22012: Division by 0 -COMMIT; - -# check transactions-8 success: 1 -# INFO: Storage engine used for t1 seems to be unable to revert -# changes made by the failing statement. -SET @@session.sql_mode = ''; -SET AUTOCOMMIT= 1; -DELETE FROM t1 WHERE f_charbig = 'was inserted'; -COMMIT WORK; -UPDATE t1 SET f_charbig = REPEAT('b', 1000); - -# check special-1 success: 1 -UPDATE t1 SET f_charbig = ''; - -# check special-2 success: 1 -UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); -INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-1 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; - -# check trigger-2 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-3 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-4 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = new.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-5 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-6 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-7 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) -SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), -'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW -BEGIN -UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, -f_charbig = 'updated by trigger' - WHERE f_int1 = - old.f_int1; -END| -DELETE FROM t0_aux -WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); - -# check trigger-8 success: 1 -DROP TRIGGER trg_1; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = 'just inserted' - WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); -DELETE FROM t0_aux -WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -DELETE FROM t1 -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = old.f_int1 + @max_row, -new.f_int2 = old.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-9 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = new.f_int1 + @max_row, -new.f_int2 = new.f_int2 - @max_row, -new.f_charbig = '####updated per update trigger####'; -END| -UPDATE t1 -SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, -f_charbig = '####updated per update statement itself####'; - -# check trigger-10 success: 1 -DROP TRIGGER trg_2; -UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), -f_int2 = CAST(f_char1 AS SIGNED INT), -f_charbig = CONCAT('===',f_char1,'==='); -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) -SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-11 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW -BEGIN -SET new.f_int1 = @my_max1 + @counter, -new.f_int2 = @my_min2 - @counter, -new.f_charbig = '####updated per insert trigger####'; -SET @counter = @counter + 1; -END| -SET @counter = 1; -SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; -INSERT INTO t1 (f_char1, f_char2, f_charbig) -SELECT CAST(f_int1 AS CHAR), -CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template -WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 -ORDER BY f_int1; -DROP TRIGGER trg_3; - -# check trigger-12 success: 1 -DELETE FROM t1 -WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) -AND f_int2 <> CAST(f_char1 AS SIGNED INT) -AND f_charbig = '####updated per insert trigger####'; -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -CHECK TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 check status OK -CHECKSUM TABLE t1 EXTENDED; -Table Checksum -test.t1 -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize status OK -# check layout success: 1 -REPAIR TABLE t1 EXTENDED; -Table Op Msg_type Msg_text -test.t1 repair status OK -# check layout success: 1 -TRUNCATE t1; - # check TRUNCATE success: 1 # check layout success: 1 # End usability test (inc/partition_check.inc) @@ -15638,7 +8519,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) ENGINE = MyISAM, PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD @@ -16152,7 +9033,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD @@ -16660,7 +9541,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD @@ -17174,7 +10055,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, SUBPARTITION subpart42 ENGINE = MyISAM)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD @@ -17686,7 +10567,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, SUBPARTITION sp12 ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = MyISAM, SUBPARTITION sp22 ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = MyISAM, SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, SUBPARTITION sp42 ENGINE = MyISAM)) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD @@ -18200,7 +11081,7 @@ t1 CREATE TABLE `t1` ( `f_charbig` varchar(1000) DEFAULT NULL, UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ unified filelist $MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD diff --git a/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result b/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result new file mode 100644 index 00000000000..b9097e33ce0 --- /dev/null +++ b/mysql-test/suite/parts/r/partition_basic_symlink_innodb.result @@ -0,0 +1,37465 @@ +SET @max_row = 20; +SET @@session.storage_engine = 'InnoDB'; + +#------------------------------------------------------------------------ +# 0. Setting of auxiliary variables + Creation of an auxiliary tables +# needed in many testcases +#------------------------------------------------------------------------ +SELECT @max_row DIV 2 INTO @max_row_div2; +SELECT @max_row DIV 3 INTO @max_row_div3; +SELECT @max_row DIV 4 INTO @max_row_div4; +SET @max_int_4 = 2147483647; +DROP TABLE IF EXISTS t0_template; +CREATE TABLE t0_template ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) , +PRIMARY KEY(f_int1)) +ENGINE = MEMORY; +# Logging of INSERTs into t0_template suppressed +DROP TABLE IF EXISTS t0_definition; +CREATE TABLE t0_definition ( +state CHAR(3), +create_command VARBINARY(5000), +file_list VARBINARY(10000), +PRIMARY KEY (state) +) ENGINE = MEMORY; +DROP TABLE IF EXISTS t0_aux; +CREATE TABLE t0_aux ( f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) ) +ENGINE = MEMORY; +SET AUTOCOMMIT= 1; +SET @@session.sql_mode= ''; +# End of basic preparations needed for all tests +#----------------------------------------------- + +#======================================================================== +# Check partitioning methods on just created tables +# The tables should be defined without/with PRIMARY KEY and +# UNIQUE INDEXes. +# Every test round has to check +# PARTITION BY HASH/KEY/LIST/RANGE +# PARTITION BY RANGE/LIST ... SUBPARTITION BY HASH/KEY ... +#======================================================================== +#------------------------------------------------------------------------ +# 1 Tables without PRIMARY KEY or UNIQUE INDEXes +#------------------------------------------------------------------------ +# 1.1 The partitioning function contains one column. +DROP TABLE IF EXISTS t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) ENGINE = InnoDB, PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = InnoDB, SUBPARTITION subpart22 ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = InnoDB, SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, SUBPARTITION subpart42 ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, SUBPARTITION sp12 ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = InnoDB, SUBPARTITION sp22 ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = InnoDB, SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, SUBPARTITION sp42 ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +# 1.1.1 with DATA DIECTORY/INDEX DIRECTORY +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +DROP TABLE IF EXISTS t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, PARTITION part0 VALUES IN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart22 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, SUBPARTITION subpart42 ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp12 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = InnoDB, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +# 1.2 The partitioning function contains two columns. +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1 + f_int2) PARTITIONS 2 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY KEY(f_int1,f_int2) PARTITIONS 5; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1,f_int2) PARTITIONS 5 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY LIST(MOD(f_int1 + f_int2,4)) +(PARTITION part_3 VALUES IN (-3), +PARTITION part_2 VALUES IN (-2), +PARTITION part_1 VALUES IN (-1), +PARTITION part_N VALUES IN (NULL), +PARTITION part0 VALUES IN (0), +PARTITION part1 VALUES IN (1), +PARTITION part2 VALUES IN (2), +PARTITION part3 VALUES IN (3)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) ENGINE = InnoDB, PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY RANGE((f_int1 + f_int2) DIV 2) +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION partc VALUES LESS THAN (10), +PARTITION partd VALUES LESS THAN (10 + 5), +PARTITION parte VALUES LESS THAN (20), +PARTITION partf VALUES LESS THAN (2147483646)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int2) SUBPARTITIONS 2 +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION partc VALUES LESS THAN (10), +PARTITION partd VALUES LESS THAN (2147483646)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int2) +(PARTITION part1 VALUES LESS THAN (0) +(SUBPARTITION subpart11, SUBPARTITION subpart12), +PARTITION part2 VALUES LESS THAN (5) +(SUBPARTITION subpart21, SUBPARTITION subpart22), +PARTITION part3 VALUES LESS THAN (10) +(SUBPARTITION subpart31, SUBPARTITION subpart32), +PARTITION part4 VALUES LESS THAN (2147483646) +(SUBPARTITION subpart41, SUBPARTITION subpart42)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = InnoDB, SUBPARTITION subpart22 ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = InnoDB, SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, SUBPARTITION subpart42 ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int2 + 1) +(PARTITION part1 VALUES IN (0) +(SUBPARTITION sp11, SUBPARTITION sp12), +PARTITION part2 VALUES IN (1) +(SUBPARTITION sp21, SUBPARTITION sp22), +PARTITION part3 VALUES IN (2) +(SUBPARTITION sp31, SUBPARTITION sp32), +PARTITION part4 VALUES IN (NULL) +(SUBPARTITION sp41, SUBPARTITION sp42)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, SUBPARTITION sp12 ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = InnoDB, SUBPARTITION sp22 ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = InnoDB, SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, SUBPARTITION sp42 ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY LIST(ABS(MOD(f_int1,2))) +SUBPARTITION BY KEY(f_int2) SUBPARTITIONS 3 +(PARTITION part1 VALUES IN (0), + PARTITION part2 VALUES IN (1), + PARTITION part3 VALUES IN (NULL)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +#------------------------------------------------------------------------ +# 2 Tables with PRIMARY KEY and/or UNIQUE INDEXes +# The partitioning function contains one column. +#------------------------------------------------------------------------ +# 2.5 PRIMARY KEY + UNIQUE INDEX consisting of two columns +DROP TABLE IF EXISTS t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +DROP TABLE IF EXISTS t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +DROP TABLE IF EXISTS t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# Attention: There are unused files. +# Either the DROP TABLE or a preceding ALTER TABLE +# worked incomplete. +# We found: +unified filelist +--- not determined --- +#------------------------------------------------------------------------ +# 3 Tables with PRIMARY KEY and/or UNIQUE INDEXes +# The partitioning function contains two columns. +#------------------------------------------------------------------------ +# 3.3 PRIMARY KEY and UNIQUE INDEX consisting of two columns +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), PRIMARY KEY(f_int2,f_int1) +) +PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1 + f_int2) PARTITIONS 2 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), PRIMARY KEY(f_int2,f_int1) +) +PARTITION BY KEY(f_int1,f_int2) PARTITIONS 5; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1,f_int2) PARTITIONS 5 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), PRIMARY KEY(f_int2,f_int1) +) +PARTITION BY LIST(MOD(f_int1 + f_int2,4)) +(PARTITION part_3 VALUES IN (-3), +PARTITION part_2 VALUES IN (-2), +PARTITION part_1 VALUES IN (-1), +PARTITION part_N VALUES IN (NULL), +PARTITION part0 VALUES IN (0), +PARTITION part1 VALUES IN (1), +PARTITION part2 VALUES IN (2), +PARTITION part3 VALUES IN (3)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) ENGINE = InnoDB, PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), PRIMARY KEY(f_int2,f_int1) +) +PARTITION BY RANGE((f_int1 + f_int2) DIV 2) +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION partc VALUES LESS THAN (10), +PARTITION partd VALUES LESS THAN (10 + 5), +PARTITION parte VALUES LESS THAN (20), +PARTITION partf VALUES LESS THAN (2147483646)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), PRIMARY KEY(f_int2,f_int1) +) +PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int2) SUBPARTITIONS 2 +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION partc VALUES LESS THAN (10), +PARTITION partd VALUES LESS THAN (2147483646)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), PRIMARY KEY(f_int2,f_int1) +) +PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int2) +(PARTITION part1 VALUES LESS THAN (0) +(SUBPARTITION subpart11, SUBPARTITION subpart12), +PARTITION part2 VALUES LESS THAN (5) +(SUBPARTITION subpart21, SUBPARTITION subpart22), +PARTITION part3 VALUES LESS THAN (10) +(SUBPARTITION subpart31, SUBPARTITION subpart32), +PARTITION part4 VALUES LESS THAN (2147483646) +(SUBPARTITION subpart41, SUBPARTITION subpart42)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = InnoDB, SUBPARTITION subpart22 ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = InnoDB, SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, SUBPARTITION subpart42 ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), PRIMARY KEY(f_int2,f_int1) +) +PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int2 + 1) +(PARTITION part1 VALUES IN (0) +(SUBPARTITION sp11, SUBPARTITION sp12), +PARTITION part2 VALUES IN (1) +(SUBPARTITION sp21, SUBPARTITION sp22), +PARTITION part3 VALUES IN (2) +(SUBPARTITION sp31, SUBPARTITION sp32), +PARTITION part4 VALUES IN (NULL) +(SUBPARTITION sp41, SUBPARTITION sp42)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, SUBPARTITION sp12 ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = InnoDB, SUBPARTITION sp22 ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = InnoDB, SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, SUBPARTITION sp42 ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), PRIMARY KEY(f_int2,f_int1) +) +PARTITION BY LIST(ABS(MOD(f_int1,2))) +SUBPARTITION BY KEY(f_int2) SUBPARTITIONS 3 +(PARTITION part1 VALUES IN (0), + PARTITION part2 VALUES IN (1), + PARTITION part3 VALUES IN (NULL)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int2`,`f_int1`), + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int2,f_int1), PRIMARY KEY(f_int1,f_int2) +) +PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1 + f_int2) PARTITIONS 2 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int2,f_int1), PRIMARY KEY(f_int1,f_int2) +) +PARTITION BY KEY(f_int1,f_int2) PARTITIONS 5; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1,f_int2) PARTITIONS 5 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int2,f_int1), PRIMARY KEY(f_int1,f_int2) +) +PARTITION BY LIST(MOD(f_int1 + f_int2,4)) +(PARTITION part_3 VALUES IN (-3), +PARTITION part_2 VALUES IN (-2), +PARTITION part_1 VALUES IN (-1), +PARTITION part_N VALUES IN (NULL), +PARTITION part0 VALUES IN (0), +PARTITION part1 VALUES IN (1), +PARTITION part2 VALUES IN (2), +PARTITION part3 VALUES IN (3)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) ENGINE = InnoDB, PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int2,f_int1), PRIMARY KEY(f_int1,f_int2) +) +PARTITION BY RANGE((f_int1 + f_int2) DIV 2) +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION partc VALUES LESS THAN (10), +PARTITION partd VALUES LESS THAN (10 + 5), +PARTITION parte VALUES LESS THAN (20), +PARTITION partf VALUES LESS THAN (2147483646)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int2,f_int1), PRIMARY KEY(f_int1,f_int2) +) +PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int2) SUBPARTITIONS 2 +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION partc VALUES LESS THAN (10), +PARTITION partd VALUES LESS THAN (2147483646)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int2,f_int1), PRIMARY KEY(f_int1,f_int2) +) +PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int2) +(PARTITION part1 VALUES LESS THAN (0) +(SUBPARTITION subpart11, SUBPARTITION subpart12), +PARTITION part2 VALUES LESS THAN (5) +(SUBPARTITION subpart21, SUBPARTITION subpart22), +PARTITION part3 VALUES LESS THAN (10) +(SUBPARTITION subpart31, SUBPARTITION subpart32), +PARTITION part4 VALUES LESS THAN (2147483646) +(SUBPARTITION subpart41, SUBPARTITION subpart42)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = InnoDB, SUBPARTITION subpart22 ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = InnoDB, SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, SUBPARTITION subpart42 ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int2,f_int1), PRIMARY KEY(f_int1,f_int2) +) +PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int2 + 1) +(PARTITION part1 VALUES IN (0) +(SUBPARTITION sp11, SUBPARTITION sp12), +PARTITION part2 VALUES IN (1) +(SUBPARTITION sp21, SUBPARTITION sp22), +PARTITION part3 VALUES IN (2) +(SUBPARTITION sp31, SUBPARTITION sp32), +PARTITION part4 VALUES IN (NULL) +(SUBPARTITION sp41, SUBPARTITION sp42)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, SUBPARTITION sp12 ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = InnoDB, SUBPARTITION sp22 ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = InnoDB, SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, SUBPARTITION sp42 ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int2,f_int1), PRIMARY KEY(f_int1,f_int2) +) +PARTITION BY LIST(ABS(MOD(f_int1,2))) +SUBPARTITION BY KEY(f_int2) SUBPARTITIONS 3 +(PARTITION part1 VALUES IN (0), + PARTITION part2 VALUES IN (1), + PARTITION part3 VALUES IN (NULL)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) NOT NULL DEFAULT '0', + `f_int2` int(11) NOT NULL DEFAULT '0', + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + PRIMARY KEY (`f_int1`,`f_int2`), + UNIQUE KEY `uidx1` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +ERROR 23000: Column 'f_int1' cannot be null +# check null success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1 + f_int2) PARTITIONS 2 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY KEY(f_int1,f_int2) PARTITIONS 5; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1,f_int2) PARTITIONS 5 */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY LIST(MOD(f_int1 + f_int2,4)) +(PARTITION part_3 VALUES IN (-3), +PARTITION part_2 VALUES IN (-2), +PARTITION part_1 VALUES IN (-1), +PARTITION part_N VALUES IN (NULL), +PARTITION part0 VALUES IN (0), +PARTITION part1 VALUES IN (1), +PARTITION part2 VALUES IN (2), +PARTITION part3 VALUES IN (3)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = InnoDB, PARTITION part_2 VALUES IN (-2) ENGINE = InnoDB, PARTITION part_1 VALUES IN (-1) ENGINE = InnoDB, PARTITION part_N VALUES IN (NULL) ENGINE = InnoDB, PARTITION part0 VALUES IN (0) ENGINE = InnoDB, PARTITION part1 VALUES IN (1) ENGINE = InnoDB, PARTITION part2 VALUES IN (2) ENGINE = InnoDB, PARTITION part3 VALUES IN (3) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY RANGE((f_int1 + f_int2) DIV 2) +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION partc VALUES LESS THAN (10), +PARTITION partd VALUES LESS THAN (10 + 5), +PARTITION parte VALUES LESS THAN (20), +PARTITION partf VALUES LESS THAN (2147483646)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (15) ENGINE = InnoDB, PARTITION parte VALUES LESS THAN (20) ENGINE = InnoDB, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int2) SUBPARTITIONS 2 +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION partc VALUES LESS THAN (10), +PARTITION partd VALUES LESS THAN (2147483646)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = InnoDB, PARTITION partb VALUES LESS THAN (5) ENGINE = InnoDB, PARTITION partc VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int2) +(PARTITION part1 VALUES LESS THAN (0) +(SUBPARTITION subpart11, SUBPARTITION subpart12), +PARTITION part2 VALUES LESS THAN (5) +(SUBPARTITION subpart21, SUBPARTITION subpart22), +PARTITION part3 VALUES LESS THAN (10) +(SUBPARTITION subpart31, SUBPARTITION subpart32), +PARTITION part4 VALUES LESS THAN (2147483646) +(SUBPARTITION subpart41, SUBPARTITION subpart42)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = InnoDB, SUBPARTITION subpart12 ENGINE = InnoDB), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = InnoDB, SUBPARTITION subpart22 ENGINE = InnoDB), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = InnoDB, SUBPARTITION subpart32 ENGINE = InnoDB), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = InnoDB, SUBPARTITION subpart42 ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int2 + 1) +(PARTITION part1 VALUES IN (0) +(SUBPARTITION sp11, SUBPARTITION sp12), +PARTITION part2 VALUES IN (1) +(SUBPARTITION sp21, SUBPARTITION sp22), +PARTITION part3 VALUES IN (2) +(SUBPARTITION sp31, SUBPARTITION sp32), +PARTITION part4 VALUES IN (NULL) +(SUBPARTITION sp41, SUBPARTITION sp42)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = InnoDB, SUBPARTITION sp12 ENGINE = InnoDB), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = InnoDB, SUBPARTITION sp22 ENGINE = InnoDB), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = InnoDB, SUBPARTITION sp32 ENGINE = InnoDB), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = InnoDB, SUBPARTITION sp42 ENGINE = InnoDB)) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY LIST(ABS(MOD(f_int1,2))) +SUBPARTITION BY KEY(f_int2) SUBPARTITIONS 3 +(PARTITION part1 VALUES IN (0), + PARTITION part2 VALUES IN (1), + PARTITION part3 VALUES IN (NULL)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = InnoDB, PARTITION part2 VALUES IN (1) ENGINE = InnoDB, PARTITION part3 VALUES IN (NULL) ENGINE = InnoDB) */ + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be able to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair note The storage engine for the table doesn't support repair +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +DROP VIEW IF EXISTS v1; +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t0_aux; +DROP TABLE IF EXISTS t0_definition; +DROP TABLE IF EXISTS t0_template; diff --git a/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result b/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result new file mode 100644 index 00000000000..7e0d5bcd62a --- /dev/null +++ b/mysql-test/suite/parts/r/partition_basic_symlink_myisam.result @@ -0,0 +1,22911 @@ +SET @max_row = 20; +SET @@session.storage_engine = 'MyISAM'; + +#------------------------------------------------------------------------ +# 0. Setting of auxiliary variables + Creation of an auxiliary tables +# needed in many testcases +#------------------------------------------------------------------------ +SELECT @max_row DIV 2 INTO @max_row_div2; +SELECT @max_row DIV 3 INTO @max_row_div3; +SELECT @max_row DIV 4 INTO @max_row_div4; +SET @max_int_4 = 2147483647; +DROP TABLE IF EXISTS t0_template; +CREATE TABLE t0_template ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) , +PRIMARY KEY(f_int1)) +ENGINE = MEMORY; +# Logging of INSERTs into t0_template suppressed +DROP TABLE IF EXISTS t0_definition; +CREATE TABLE t0_definition ( +state CHAR(3), +create_command VARBINARY(5000), +file_list VARBINARY(10000), +PRIMARY KEY (state) +) ENGINE = MEMORY; +DROP TABLE IF EXISTS t0_aux; +CREATE TABLE t0_aux ( f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) ) +ENGINE = MEMORY; +SET AUTOCOMMIT= 1; +SET @@session.sql_mode= ''; +# End of basic preparations needed for all tests +#----------------------------------------------- + +#======================================================================== +# Check partitioning methods on just created tables +# The tables should be defined without/with PRIMARY KEY and +# UNIQUE INDEXes. +# Every test round has to check +# PARTITION BY HASH/KEY/LIST/RANGE +# PARTITION BY RANGE/LIST ... SUBPARTITION BY HASH/KEY ... +#======================================================================== +#------------------------------------------------------------------------ +# 1 Tables without PRIMARY KEY or UNIQUE INDEXes +#------------------------------------------------------------------------ +# 1.1 The partitioning function contains one column. +DROP TABLE IF EXISTS t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) ENGINE = MyISAM, PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, SUBPARTITION subpart42 ENGINE = MyISAM)) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, SUBPARTITION sp12 ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = MyISAM, SUBPARTITION sp22 ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = MyISAM, SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, SUBPARTITION sp42 ENGINE = MyISAM)) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# 1.1.1 with DATA DIECTORY/INDEX DIRECTORY +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI +# check layout success: 0 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI +# check layout success: 0 +TRUNCATE t1; + +# check TRUNCATE success: 1 +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI +# check layout success: 0 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p3.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p4.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#p5.MYD +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p3.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p4.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#p5.MYI + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p5.MYI +# check layout success: 0 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p5.MYI +# check layout success: 0 +TRUNCATE t1; + +# check TRUNCATE success: 1 +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) (PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p3 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p4 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION p5 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#p5.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#p1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p4.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#p5.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#p1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p4.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#p5.MYI +# check layout success: 0 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part0.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_1.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_2.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_3.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_N.MYD +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part0.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_1.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_2.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_3.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_N.MYI + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_N.MYI +# check layout success: 0 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_N.MYI +# check layout success: 0 +TRUNCATE t1; + +# check TRUNCATE success: 1 +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_3.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part_N.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_3.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part_N.MYI +# check layout success: 0 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#parte.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partf.MYD +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#parte.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partf.MYI + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partf.MYI +# check layout success: 0 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partf.MYI +# check layout success: 0 +TRUNCATE t1; + +# check TRUNCATE success: 1 +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#parte.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partf.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#parte.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partf.MYI +# check layout success: 0 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp0.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp1.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp0.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp1.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp1.MYI + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp1.MYI +# check layout success: 0 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp1.MYI +# check layout success: 0 +TRUNCATE t1; + +# check TRUNCATE success: 1 +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#parta#SP#partasp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partb#SP#partbsp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partc#SP#partcsp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#partd#SP#partdsp1.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#parta#SP#partasp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partb#SP#partbsp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partc#SP#partcsp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#partd#SP#partdsp1.MYI +# check layout success: 0 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart11.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart12.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart21.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart22.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart31.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart32.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart41.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart42.MYD +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart11.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart12.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart21.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart22.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart31.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart32.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart41.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart42.MYI + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart42.MYI +# check layout success: 0 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart42.MYI +# check layout success: 0 +TRUNCATE t1; + +# check TRUNCATE success: 1 +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart11.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#subpart12.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart21.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#subpart22.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart31.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#subpart32.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart41.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#subpart42.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart11.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#subpart12.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart21.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#subpart22.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart31.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#subpart32.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart41.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#subpart42.MYI +# check layout success: 0 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp11.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp12.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp21.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp22.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp31.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp32.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp41.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp42.MYD +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp11.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp12.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp21.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp22.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp31.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp32.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp41.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp42.MYI + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp42.MYI +# check layout success: 0 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp42.MYI +# check layout success: 0 +TRUNCATE t1; + +# check TRUNCATE success: 1 +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp11.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#sp12.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp21.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#sp22.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp31.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#sp32.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp41.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part4#SP#sp42.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp11.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#sp12.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp21.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#sp22.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp31.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#sp32.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp41.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part4#SP#sp42.MYI +# check layout success: 0 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp2.MYI + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp2.MYI +# check layout success: 0 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp2.MYI +# check layout success: 0 +TRUNCATE t1; + +# check TRUNCATE success: 1 +state new +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par +state old +Table definition SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `f_int1` int(11) DEFAULT NULL, `f_int2` int(11) DEFAULT NULL, `f_char1` char(20) DEFAULT NULL, `f_char2` char(20) DEFAULT NULL, `f_charbig` varchar(1000) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ +File list MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI MYSQLTEST_VARDIR/master-data/test/t1.frm MYSQLTEST_VARDIR/master-data/test/t1.par MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part1#SP#part1sp2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part2#SP#part2sp2.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp0.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp1.MYD MYSQLTEST_VARDIR/master-data/test/data/t1#P#part3#SP#part3sp2.MYD MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part1#SP#part1sp2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part2#SP#part2sp2.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp0.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp1.MYI MYSQLTEST_VARDIR/master-data/test/index/t1#P#part3#SP#part3sp2.MYI +# check layout success: 0 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +DROP TABLE IF EXISTS t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, SUBPARTITION subpart42 ENGINE = MyISAM)) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +# 1.2 The partitioning function contains two columns. +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1 + f_int2) PARTITIONS 2 */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY KEY(f_int1,f_int2) PARTITIONS 5; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1,f_int2) PARTITIONS 5 */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY LIST(MOD(f_int1 + f_int2,4)) +(PARTITION part_3 VALUES IN (-3), +PARTITION part_2 VALUES IN (-2), +PARTITION part_1 VALUES IN (-1), +PARTITION part_N VALUES IN (NULL), +PARTITION part0 VALUES IN (0), +PARTITION part1 VALUES IN (1), +PARTITION part2 VALUES IN (2), +PARTITION part3 VALUES IN (3)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) ENGINE = MyISAM, PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY RANGE((f_int1 + f_int2) DIV 2) +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION partc VALUES LESS THAN (10), +PARTITION partd VALUES LESS THAN (10 + 5), +PARTITION parte VALUES LESS THAN (20), +PARTITION partf VALUES LESS THAN (2147483646)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int2) SUBPARTITIONS 2 +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION partc VALUES LESS THAN (10), +PARTITION partd VALUES LESS THAN (2147483646)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int2) +(PARTITION part1 VALUES LESS THAN (0) +(SUBPARTITION subpart11, SUBPARTITION subpart12), +PARTITION part2 VALUES LESS THAN (5) +(SUBPARTITION subpart21, SUBPARTITION subpart22), +PARTITION part3 VALUES LESS THAN (10) +(SUBPARTITION subpart31, SUBPARTITION subpart32), +PARTITION part4 VALUES LESS THAN (2147483646) +(SUBPARTITION subpart41, SUBPARTITION subpart42)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, SUBPARTITION subpart42 ENGINE = MyISAM)) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int2 + 1) +(PARTITION part1 VALUES IN (0) +(SUBPARTITION sp11, SUBPARTITION sp12), +PARTITION part2 VALUES IN (1) +(SUBPARTITION sp21, SUBPARTITION sp22), +PARTITION part3 VALUES IN (2) +(SUBPARTITION sp31, SUBPARTITION sp32), +PARTITION part4 VALUES IN (NULL) +(SUBPARTITION sp41, SUBPARTITION sp42)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, SUBPARTITION sp12 ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = MyISAM, SUBPARTITION sp22 ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = MyISAM, SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, SUBPARTITION sp42 ENGINE = MyISAM)) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) + +) +PARTITION BY LIST(ABS(MOD(f_int1,2))) +SUBPARTITION BY KEY(f_int2) SUBPARTITIONS 3 +(PARTITION part1 VALUES IN (0), + PARTITION part2 VALUES IN (1), + PARTITION part3 VALUES IN (NULL)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +# check prerequisites-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# INFO: Neither f_int1 nor f_int2 nor (f_int1,f_int2) is UNIQUE +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +#------------------------------------------------------------------------ +# 2 Tables with PRIMARY KEY and/or UNIQUE INDEXes +# The partitioning function contains one column. +#------------------------------------------------------------------------ +# 2.5 PRIMARY KEY + UNIQUE INDEX consisting of two columns +DROP TABLE IF EXISTS t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1) PARTITIONS 2 */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1) PARTITIONS 5 */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1,4)) (PARTITION part_3 VALUES IN (-3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part0 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part1 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (3) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1 DIV 2) SUBPARTITION BY HASH (f_int1) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int1) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION subpart42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int1 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp12 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp22 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp32 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, SUBPARTITION sp42 DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM)) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int1) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part2 VALUES IN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/data' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/test/index' ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +#------------------------------------------------------------------------ +# 3 Tables with PRIMARY KEY and/or UNIQUE INDEXes +# The partitioning function contains two columns. +#------------------------------------------------------------------------ +# 3.3 PRIMARY KEY and UNIQUE INDEX consisting of two columns +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY HASH(f_int1 + f_int2) PARTITIONS 2; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (f_int1 + f_int2) PARTITIONS 2 */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY KEY(f_int1,f_int2) PARTITIONS 5; +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (f_int1,f_int2) PARTITIONS 5 */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#p4.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY LIST(MOD(f_int1 + f_int2,4)) +(PARTITION part_3 VALUES IN (-3), +PARTITION part_2 VALUES IN (-2), +PARTITION part_1 VALUES IN (-1), +PARTITION part_N VALUES IN (NULL), +PARTITION part0 VALUES IN (0), +PARTITION part1 VALUES IN (1), +PARTITION part2 VALUES IN (2), +PARTITION part3 VALUES IN (3)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (MOD(f_int1 + f_int2,4)) (PARTITION part_3 VALUES IN (-3) ENGINE = MyISAM, PARTITION part_2 VALUES IN (-2) ENGINE = MyISAM, PARTITION part_1 VALUES IN (-1) ENGINE = MyISAM, PARTITION part_N VALUES IN (NULL) ENGINE = MyISAM, PARTITION part0 VALUES IN (0) ENGINE = MyISAM, PARTITION part1 VALUES IN (1) ENGINE = MyISAM, PARTITION part2 VALUES IN (2) ENGINE = MyISAM, PARTITION part3 VALUES IN (3) ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_3.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part_N.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY RANGE((f_int1 + f_int2) DIV 2) +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION partc VALUES LESS THAN (10), +PARTITION partd VALUES LESS THAN (10 + 5), +PARTITION parte VALUES LESS THAN (20), +PARTITION partf VALUES LESS THAN (2147483646)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE ((f_int1 + f_int2) DIV 2) (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (15) ENGINE = MyISAM, PARTITION parte VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION partf VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parte.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partf.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int2) SUBPARTITIONS 2 +(PARTITION parta VALUES LESS THAN (0), +PARTITION partb VALUES LESS THAN (5), +PARTITION partc VALUES LESS THAN (10), +PARTITION partd VALUES LESS THAN (2147483646)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY HASH (f_int2) SUBPARTITIONS 2 (PARTITION parta VALUES LESS THAN (0) ENGINE = MyISAM, PARTITION partb VALUES LESS THAN (5) ENGINE = MyISAM, PARTITION partc VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION partd VALUES LESS THAN (2147483646) ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#parta#SP#partasp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partb#SP#partbsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partc#SP#partcsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#partd#SP#partdsp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY RANGE(f_int1) SUBPARTITION BY KEY(f_int2) +(PARTITION part1 VALUES LESS THAN (0) +(SUBPARTITION subpart11, SUBPARTITION subpart12), +PARTITION part2 VALUES LESS THAN (5) +(SUBPARTITION subpart21, SUBPARTITION subpart22), +PARTITION part3 VALUES LESS THAN (10) +(SUBPARTITION subpart31, SUBPARTITION subpart32), +PARTITION part4 VALUES LESS THAN (2147483646) +(SUBPARTITION subpart41, SUBPARTITION subpart42)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (f_int1) SUBPARTITION BY KEY (f_int2) (PARTITION part1 VALUES LESS THAN (0) (SUBPARTITION subpart11 ENGINE = MyISAM, SUBPARTITION subpart12 ENGINE = MyISAM), PARTITION part2 VALUES LESS THAN (5) (SUBPARTITION subpart21 ENGINE = MyISAM, SUBPARTITION subpart22 ENGINE = MyISAM), PARTITION part3 VALUES LESS THAN (10) (SUBPARTITION subpart31 ENGINE = MyISAM, SUBPARTITION subpart32 ENGINE = MyISAM), PARTITION part4 VALUES LESS THAN (2147483646) (SUBPARTITION subpart41 ENGINE = MyISAM, SUBPARTITION subpart42 ENGINE = MyISAM)) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart11.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#subpart12.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart21.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#subpart22.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart31.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#subpart32.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart41.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#subpart42.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; +ERROR HY000: Table has no partition for value 2147483647 +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY LIST(ABS(MOD(f_int1,3))) SUBPARTITION BY HASH(f_int2 + 1) +(PARTITION part1 VALUES IN (0) +(SUBPARTITION sp11, SUBPARTITION sp12), +PARTITION part2 VALUES IN (1) +(SUBPARTITION sp21, SUBPARTITION sp22), +PARTITION part3 VALUES IN (2) +(SUBPARTITION sp31, SUBPARTITION sp32), +PARTITION part4 VALUES IN (NULL) +(SUBPARTITION sp41, SUBPARTITION sp42)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,3))) SUBPARTITION BY HASH (f_int2 + 1) (PARTITION part1 VALUES IN (0) (SUBPARTITION sp11 ENGINE = MyISAM, SUBPARTITION sp12 ENGINE = MyISAM), PARTITION part2 VALUES IN (1) (SUBPARTITION sp21 ENGINE = MyISAM, SUBPARTITION sp22 ENGINE = MyISAM), PARTITION part3 VALUES IN (2) (SUBPARTITION sp31 ENGINE = MyISAM, SUBPARTITION sp32 ENGINE = MyISAM), PARTITION part4 VALUES IN (NULL) (SUBPARTITION sp41 ENGINE = MyISAM, SUBPARTITION sp42 ENGINE = MyISAM)) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp11.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#sp12.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp21.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#sp22.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp31.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#sp32.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp41.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part4#SP#sp42.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +CREATE TABLE t1 ( +f_int1 INTEGER, +f_int2 INTEGER, +f_char1 CHAR(20), +f_char2 CHAR(20), +f_charbig VARCHAR(1000) +, UNIQUE INDEX uidx1 (f_int1,f_int2), UNIQUE INDEX uidx2 (f_int2,f_int1) +) +PARTITION BY LIST(ABS(MOD(f_int1,2))) +SUBPARTITION BY KEY(f_int2) SUBPARTITIONS 3 +(PARTITION part1 VALUES IN (0), + PARTITION part2 VALUES IN (1), + PARTITION part3 VALUES IN (NULL)); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +# Start usability test (inc/partition_check.inc) +create_command +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f_int1` int(11) DEFAULT NULL, + `f_int2` int(11) DEFAULT NULL, + `f_char1` char(20) DEFAULT NULL, + `f_char2` char(20) DEFAULT NULL, + `f_charbig` varchar(1000) DEFAULT NULL, + UNIQUE KEY `uidx1` (`f_int1`,`f_int2`), + UNIQUE KEY `uidx2` (`f_int2`,`f_int1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (ABS(MOD(f_int1,2))) SUBPARTITION BY KEY (f_int2) SUBPARTITIONS 3 (PARTITION part1 VALUES IN (0) ENGINE = MyISAM, PARTITION part2 VALUES IN (1) ENGINE = MyISAM, PARTITION part3 VALUES IN (NULL) ENGINE = MyISAM) */ + +unified filelist +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part1#SP#part1sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part2#SP#part2sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp0.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp1.MYI +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYD +$MYSQLTEST_VARDIR/master-data/test/t1#P#part3#SP#part3sp2.MYI +$MYSQLTEST_VARDIR/master-data/test/t1.frm +$MYSQLTEST_VARDIR/master-data/test/t1.par + +# check prerequisites-1 success: 1 +# check COUNT(*) success: 1 +# check MIN/MAX(f_int1) success: 1 +# check MIN/MAX(f_int2) success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +ERROR 23000: Can't write; duplicate key in table 't1' +# check prerequisites-3 success: 1 +# INFO: f_int1 AND/OR f_int2 AND/OR (f_int1,f_int2) is UNIQUE +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, 2 * @max_row + f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT 2 * @max_row + f_int1, f_int1, CAST((2 * @max_row + f_int1) AS CHAR), +CAST((2 * @max_row + f_int1) AS CHAR), 'delete me' FROM t0_template +WHERE f_int1 IN (2,3); +DELETE FROM t1 WHERE f_charbig = 'delete me'; +# check read via f_int1 success: 1 +# check read via f_int2 success: 1 + +# check multiple-1 success: 1 +DELETE FROM t1 WHERE MOD(f_int1,3) = 0; + +# check multiple-2 success: 1 +INSERT INTO t1 SELECT * FROM t0_template +WHERE MOD(f_int1,3) = 0; + +# check multiple-3 success: 1 +UPDATE t1 SET f_int1 = f_int1 + @max_row +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 +AND @max_row_div2 + @max_row_div4; + +# check multiple-4 success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - @max_row_div4 + @max_row +AND @max_row_div2 + @max_row_div4 + @max_row; + +# check multiple-5 success: 1 +SELECT COUNT(*) INTO @try_count FROM t0_template +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT COUNT(*) INTO @clash_count +FROM t1 INNER JOIN t0_template USING(f_int1) +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row; +SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-1 success: 1 +SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +INSERT INTO t1 +SET f_int1 = @cur_value , f_int2 = @cur_value, +f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), +f_charbig = '#SINGLE#'; + +# check single-2 success: 1 +SELECT MIN(f_int1) INTO @cur_value1 FROM t1; +SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value2 +WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; + +# check single-3 success: 1 +SET @cur_value1= -1; +SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +UPDATE t1 SET f_int1 = @cur_value1 +WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; + +# check single-4 success: 1 +SELECT MAX(f_int1) INTO @cur_value FROM t1; +DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; + +# check single-5 success: 1 +DELETE FROM t1 WHERE f_int1 = -1 AND f_charbig = '#SINGLE#'; + +# check single-6 success: 1 +INSERT INTO t1 SET f_int1 = @max_int_4 , f_int2 = @max_int_4, f_charbig = '#2147483647##'; + +# check single-7 success: 1 +DELETE FROM t1 WHERE f_charbig = '#2147483647##'; +DELETE FROM t1 WHERE f_int1 IS NULL OR f_int1 = 0; +INSERT t1 SET f_int1 = 0 , f_int2 = 0, +f_char1 = CAST(0 AS CHAR), f_char2 = CAST(0 AS CHAR), +f_charbig = '#NULL#'; +INSERT INTO t1 +SET f_int1 = NULL , f_int2 = -@max_row, +f_char1 = CAST(-@max_row AS CHAR), f_char2 = CAST(-@max_row AS CHAR), +f_charbig = '#NULL#'; +# check null success: 1 + +# check null-1 success: 1 +UPDATE t1 SET f_int1 = -@max_row +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-2 success: 1 +UPDATE t1 SET f_int1 = NULL +WHERE f_int1 = -@max_row AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-3 success: 1 +DELETE FROM t1 +WHERE f_int1 IS NULL AND f_int2 = -@max_row AND f_char1 = CAST(-@max_row AS CHAR) +AND f_char2 = CAST(-@max_row AS CHAR) AND f_charbig = '#NULL#'; + +# check null-4 success: 1 +DELETE FROM t1 +WHERE f_int1 = 0 AND f_int2 = 0 +AND f_char1 = CAST(0 AS CHAR) AND f_char2 = CAST(0 AS CHAR) +AND f_charbig = '#NULL#'; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 +AND f_int1 BETWEEN @max_row_div2 AND @max_row +ON DUPLICATE KEY +UPDATE f_int1 = 2 * @max_row + source_tab.f_int1, +f_int2 = 2 * @max_row + source_tab.f_int1, +f_charbig = 'was updated'; + +# check unique-1-a success: 1 + +# check unique-1-b success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'===') +WHERE f_charbig = 'was updated'; +REPLACE INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, - f_int1, '', '', 'was inserted or replaced' + FROM t0_template source_tab +WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + +# check replace success: 1 +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 AND @max_row_div2 + @max_row_div4; +DELETE FROM t1 +WHERE f_int1 = f_int2 AND MOD(f_int1,3) = 0 AND +f_int1 BETWEEN @max_row_div2 + @max_row_div4 AND @max_row; +UPDATE t1 SET f_int2 = f_int1, +f_char1 = CAST(f_int1 AS CHAR), +f_char2 = CAST(f_int1 AS CHAR), +f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'===') +WHERE f_charbig = 'was inserted or replaced' AND f_int1 = - f_int2; +SET AUTOCOMMIT= 0; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-1 success: 1 +COMMIT WORK; + +# check transactions-2 success: 1 +ROLLBACK WORK; + +# check transactions-3 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +ROLLBACK WORK; + +# check transactions-4 success: 1 +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, '', '', 'was inserted' +FROM t0_template source_tab +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; + +# check transactions-5 success: 1 +ROLLBACK WORK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back + +# check transactions-6 success: 1 +# INFO: Storage engine used for t1 seems to be not transactional. +COMMIT; + +# check transactions-7 success: 1 +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +SET @@session.sql_mode = 'traditional'; +SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT IF(f_int1 = @max_row_div2,f_int1 / 0,f_int1),f_int1, +'', '', 'was inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +ERROR 22012: Division by 0 +COMMIT; + +# check transactions-8 success: 1 +# INFO: Storage engine used for t1 seems to be unable to revert +# changes made by the failing statement. +SET @@session.sql_mode = ''; +SET AUTOCOMMIT= 1; +DELETE FROM t1 WHERE f_charbig = 'was inserted'; +COMMIT WORK; +UPDATE t1 SET f_charbig = REPEAT('b', 1000); + +# check special-1 success: 1 +UPDATE t1 SET f_charbig = ''; + +# check special-2 success: 1 +UPDATE t1 SET f_charbig = CONCAT('===',CAST(f_int1 AS CHAR),'==='); +INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-1 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER INSERT ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT f_int1,f_int2,f_char1,f_char2,NULL FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; + +# check trigger-2 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-3 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-4 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = new.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-5 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER UPDATE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +UPDATE t0_aux SET f_int1 = - f_int1, f_int2 = - f_int2 +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-6 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 BEFORE DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-7 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +INSERT INTO t0_aux(f_int1,f_int2,f_char1,f_char2,f_charbig) +SELECT -f_int1,-f_int1,CAST(-f_int1 AS CHAR),CAST(-f_int1 AS CHAR), +'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_1 AFTER DELETE ON t0_aux FOR EACH ROW +BEGIN +UPDATE t1 SET f_int1 = -f_int1, f_int2 = -f_int2, +f_charbig = 'updated by trigger' + WHERE f_int1 = - old.f_int1; +END| +DELETE FROM t0_aux +WHERE f_int1 IN (- (@max_row_div2 - 1),- @max_row_div2,- (@max_row_div2 + 1)); + +# check trigger-8 success: 1 +DROP TRIGGER trg_1; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = 'just inserted' + WHERE f_int1 <> CAST(f_char1 AS SIGNED INT); +DELETE FROM t0_aux +WHERE ABS(f_int1) BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +DELETE FROM t1 +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1; +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = old.f_int1 + @max_row, +new.f_int2 = old.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-9 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_2 BEFORE UPDATE ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = new.f_int1 + @max_row, +new.f_int2 = new.f_int2 - @max_row, +new.f_charbig = '####updated per update trigger####'; +END| +UPDATE t1 +SET f_int1 = f_int1 + @max_row, f_int2 = f_int2 - @max_row, +f_charbig = '####updated per update statement itself####'; + +# check trigger-10 success: 1 +DROP TRIGGER trg_2; +UPDATE t1 SET f_int1 = CAST(f_char1 AS SIGNED INT), +f_int2 = CAST(f_char1 AS SIGNED INT), +f_charbig = CONCAT('===',f_char1,'==='); +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) +SELECT f_int1, f_int1, CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-11 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +CREATE TRIGGER trg_3 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +SET new.f_int1 = @my_max1 + @counter, +new.f_int2 = @my_min2 - @counter, +new.f_charbig = '####updated per insert trigger####'; +SET @counter = @counter + 1; +END| +SET @counter = 1; +SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +INSERT INTO t1 (f_char1, f_char2, f_charbig) +SELECT CAST(f_int1 AS CHAR), +CAST(f_int1 AS CHAR), 'just inserted' FROM t0_template +WHERE f_int1 BETWEEN @max_row_div2 - 1 AND @max_row_div2 + 1 +ORDER BY f_int1; +DROP TRIGGER trg_3; + +# check trigger-12 success: 1 +DELETE FROM t1 +WHERE f_int1 <> CAST(f_char1 AS SIGNED INT) +AND f_int2 <> CAST(f_char1 AS SIGNED INT) +AND f_charbig = '####updated per insert trigger####'; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +CHECKSUM TABLE t1 EXTENDED; +Table Checksum +test.t1 +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +# check layout success: 1 +REPAIR TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 repair status OK +# check layout success: 1 +TRUNCATE t1; + +# check TRUNCATE success: 1 +# check layout success: 1 +# End usability test (inc/partition_check.inc) +DROP TABLE t1; +DROP VIEW IF EXISTS v1; +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t0_aux; +DROP TABLE IF EXISTS t0_definition; +DROP TABLE IF EXISTS t0_template; diff --git a/mysql-test/suite/parts/r/partition_bit_innodb.result b/mysql-test/suite/parts/r/partition_bit_innodb.result index 9f6403090ee..22d1d0e0a30 100644 --- a/mysql-test/suite/parts/r/partition_bit_innodb.result +++ b/mysql-test/suite/parts/r/partition_bit_innodb.result @@ -12,18 +12,14 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a bit(0), primary key (a)) engine='INNODB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp', -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp'); +partition pa1, +partition pa2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bit(1) NOT NULL DEFAULT '\0', PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 ENGINE = InnoDB, PARTITION pa2 ENGINE = InnoDB) */ drop table t1; create table t1 (a bit(64), primary key (a)) engine='INNODB' partition by key (a) partitions 2; @@ -49,24 +45,16 @@ FFFFFFFFFFFFFFFF drop table t1; create table t1 (a bit(64), primary key (a)) engine='INNODB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (b'1111111111111111111111111111111111111111111111111111111111111111'), (b'1000000000000000000000000000000000000000000000000000000000000000'), @@ -105,8 +93,8 @@ t2 CREATE TABLE `t2` ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) PARTITIONS 4 */ select hex(a) from t2; hex(a) -1 0 +1 alter table t2 add primary key (a); show create table t2; Table Create Table @@ -142,20 +130,6 @@ count(*) select hex(a) from t3; hex(a) 1 -2 -3 -4 -5 -6 -7 -8 -9 -A -B -C -D -E -F 10 11 12 @@ -172,6 +146,7 @@ F 1D 1E 1F +2 20 21 22 @@ -188,6 +163,7 @@ F 2D 2E 2F +3 30 31 32 @@ -204,6 +180,7 @@ F 3D 3E 3F +4 40 41 42 @@ -220,6 +197,7 @@ F 4D 4E 4F +5 50 51 52 @@ -235,6 +213,7 @@ F 5D 5E 5F +6 60 61 62 @@ -251,6 +230,7 @@ F 6D 6E 6F +7 70 71 72 @@ -267,6 +247,7 @@ F 7D 7E 7F +8 80 81 82 @@ -283,6 +264,7 @@ F 8D 8E 8F +9 90 91 92 @@ -299,6 +281,7 @@ F 9D 9E 9F +A A0 A1 A2 @@ -315,6 +298,7 @@ AC AD AE AF +B B0 B1 B2 @@ -331,6 +315,7 @@ BC BD BE BF +C C0 C1 C2 @@ -347,6 +332,7 @@ CC CD CE CF +D D0 D1 D2 @@ -363,6 +349,7 @@ DC DD DE DF +E E0 E1 E2 @@ -379,6 +366,7 @@ EC ED EE EF +F F0 F1 F2 @@ -417,20 +405,6 @@ count(*) 31 select hex(a) from t4; hex(a) -2 -3 -4 -5 -6 -7 -8 -9 -A -B -C -D -E -F 10 11 12 @@ -447,5 +421,19 @@ F 1D 1E 1F +2 20 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F drop table t4; diff --git a/mysql-test/suite/parts/r/partition_bit_myisam.result b/mysql-test/suite/parts/r/partition_bit_myisam.result index e5b31e0c154..d4b81fc74b5 100644 --- a/mysql-test/suite/parts/r/partition_bit_myisam.result +++ b/mysql-test/suite/parts/r/partition_bit_myisam.result @@ -12,18 +12,14 @@ t1 CREATE TABLE `t1` ( drop table t1; create table t1 (a bit(0), primary key (a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp', -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp'); +partition pa1, +partition pa2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bit(1) NOT NULL DEFAULT '\0', PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 ENGINE = MyISAM, PARTITION pa2 ENGINE = MyISAM) */ drop table t1; create table t1 (a bit(64), primary key (a)) engine='MyISAM' partition by key (a) partitions 2; @@ -49,24 +45,16 @@ FFFFFFFFFFFFFFFF drop table t1; create table t1 (a bit(64), primary key (a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (b'1111111111111111111111111111111111111111111111111111111111111111'), (b'1000000000000000000000000000000000000000000000000000000000000000'), @@ -142,20 +130,6 @@ count(*) select hex(a) from t3; hex(a) 1 -2 -3 -4 -5 -6 -7 -8 -9 -A -B -C -D -E -F 10 11 12 @@ -172,6 +146,7 @@ F 1D 1E 1F +2 20 21 22 @@ -188,6 +163,7 @@ F 2D 2E 2F +3 30 31 32 @@ -204,6 +180,7 @@ F 3D 3E 3F +4 40 41 42 @@ -220,6 +197,7 @@ F 4D 4E 4F +5 50 51 52 @@ -235,6 +213,7 @@ F 5D 5E 5F +6 60 61 62 @@ -251,6 +230,7 @@ F 6D 6E 6F +7 70 71 72 @@ -267,6 +247,7 @@ F 7D 7E 7F +8 80 81 82 @@ -283,6 +264,7 @@ F 8D 8E 8F +9 90 91 92 @@ -299,6 +281,7 @@ F 9D 9E 9F +A A0 A1 A2 @@ -315,6 +298,7 @@ AC AD AE AF +B B0 B1 B2 @@ -331,6 +315,7 @@ BC BD BE BF +C C0 C1 C2 @@ -347,6 +332,7 @@ CC CD CE CF +D D0 D1 D2 @@ -363,6 +349,7 @@ DC DD DE DF +E E0 E1 E2 @@ -379,6 +366,7 @@ EC ED EE EF +F F0 F1 F2 @@ -417,20 +405,6 @@ count(*) 31 select hex(a) from t4; hex(a) -2 -3 -4 -5 -6 -7 -8 -9 -A -B -C -D -E -F 10 11 12 @@ -447,5 +421,19 @@ F 1D 1E 1F +2 20 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F drop table t4; diff --git a/mysql-test/suite/parts/r/partition_char_innodb.result b/mysql-test/suite/parts/r/partition_char_innodb.result index c9609537f08..455ff0353ed 100644 --- a/mysql-test/suite/parts/r/partition_char_innodb.result +++ b/mysql-test/suite/parts/r/partition_char_innodb.result @@ -1,24 +1,16 @@ ---- Partitioning and char data type create table t1 (a char(255) not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(255) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64)); select * from t1; a @@ -107,24 +99,16 @@ drop table t2; ---- Partitioning and binary data type create table t1 (a binary(255) not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` binary(255) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64)); select hex(a) from t1; hex(a) @@ -216,24 +200,16 @@ drop table t2; ---- Partitioning and varchar data type create table t1 (a varchar(767) not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(767) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (repeat('a',767)), ('b'), (repeat('a',500)), (repeat('b',64)); select * from t1; a @@ -322,24 +298,16 @@ drop table t2; ---- Partitioning and varbinary data type create table t1 (a varbinary(767) not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(767) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (repeat('a',767)), ('b'), (repeat('a',500)), (repeat('b',64)); select * from t1; a @@ -428,24 +396,16 @@ drop table t2; ---- Partitioning and enum data type create table t1 (a enum('A','B','C','D','E','F','G','H','I','J','K','L') not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('A','B','C','D','E','F','G','H','I','J','K','L') NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values ('A'),('D'),('L'),('G'); select * from t1; a @@ -558,24 +518,16 @@ drop table t2; ---- Partitioning and set data type create table t1 (a set('A','B','C','D','E','F','G','H','I','J','K','L') not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` set('A','B','C','D','E','F','G','H','I','J','K','L') NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values ('A,B'),('C,D'),('E,L'),('G,H,K'); select * from t1 order by a; a @@ -727,18 +679,10 @@ drop table t2; ---- Partitioning and blob data type create table t1 (a blob not null, primary key(a(767))) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); ERROR HY000: A BLOB field is not allowed in partition function create table t2 (a blob not null, primary key(a(767))) engine='InnoDB' partition by key (a) partitions 30; @@ -755,18 +699,10 @@ ERROR HY000: A BLOB field is not allowed in partition function ---- Partitioning and text data type create table t1 (a text not null, primary key(a(767))) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); ERROR HY000: A BLOB field is not allowed in partition function create table t2 (a tinytext not null, primary key(a(767))) engine='InnoDB' partition by key (a) partitions 30; diff --git a/mysql-test/suite/parts/r/partition_char_myisam.result b/mysql-test/suite/parts/r/partition_char_myisam.result index 1009f52348d..af25f4b19a4 100644 --- a/mysql-test/suite/parts/r/partition_char_myisam.result +++ b/mysql-test/suite/parts/r/partition_char_myisam.result @@ -1,24 +1,16 @@ ---- Partitioning and char data type create table t1 (a char(255) not null, primary key(a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(255) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64)); select * from t1; a @@ -107,24 +99,16 @@ drop table t2; ---- Partitioning and binary data type create table t1 (a binary(255) not null, primary key(a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` binary(255) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (repeat('a',255)), ('b'), (repeat('a',128)), (repeat('b',64)); select hex(a) from t1; hex(a) @@ -216,24 +200,16 @@ drop table t2; ---- Partitioning and varchar data type create table t1 (a varchar(767) not null, primary key(a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varchar(767) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (repeat('a',767)), ('b'), (repeat('a',500)), (repeat('b',64)); select * from t1; a @@ -322,24 +298,16 @@ drop table t2; ---- Partitioning and varbinary data type create table t1 (a varbinary(767) not null, primary key(a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` varbinary(767) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (repeat('a',767)), ('b'), (repeat('a',500)), (repeat('b',64)); select * from t1; a @@ -428,24 +396,16 @@ drop table t2; ---- Partitioning and enum data type create table t1 (a enum('A','B','C','D','E','F','G','H','I','J','K','L') not null, primary key(a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` enum('A','B','C','D','E','F','G','H','I','J','K','L') NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values ('A'),('D'),('L'),('G'); select * from t1; a @@ -558,24 +518,16 @@ drop table t2; ---- Partitioning and set data type create table t1 (a set('A','B','C','D','E','F','G','H','I','J','K','L') not null, primary key(a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` set('A','B','C','D','E','F','G','H','I','J','K','L') NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values ('A,B'),('C,D'),('E,L'),('G,H,K'); select * from t1 order by a; a @@ -727,18 +679,10 @@ drop table t2; ---- Partitioning and blob data type create table t1 (a blob not null, primary key(a(767))) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); ERROR HY000: A BLOB field is not allowed in partition function create table t2 (a blob not null, primary key(a(767))) engine='MyISAM' partition by key (a) partitions 30; @@ -755,18 +699,10 @@ ERROR HY000: A BLOB field is not allowed in partition function ---- Partitioning and text data type create table t1 (a text not null, primary key(a(767))) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); ERROR HY000: A BLOB field is not allowed in partition function create table t2 (a tinytext not null, primary key(a(767))) engine='MyISAM' partition by key (a) partitions 30; diff --git a/mysql-test/suite/parts/r/partition_datetime_innodb.result b/mysql-test/suite/parts/r/partition_datetime_innodb.result index 4ced059ba9e..0d95df98bbf 100644 --- a/mysql-test/suite/parts/r/partition_datetime_innodb.result +++ b/mysql-test/suite/parts/r/partition_datetime_innodb.result @@ -1,23 +1,15 @@ create table t1 (a timestamp not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59'); select * from t1; a @@ -281,24 +273,16 @@ a drop table t4; create table t1 (a date not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values ('1975-01-01'), ('2020-12-31'), ('1980-10-14'), ('2000-06-15'); select * from t1; a @@ -608,24 +592,16 @@ a drop table t4; create table t1 (a time not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values ('21:21:21'), ('12:10:30'), ('03:03:03'), ('23:59'); select * from t1; a @@ -1073,24 +1049,16 @@ a drop table t4; create table t1 (a datetime not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59'); select * from t1; a @@ -1350,24 +1318,16 @@ a drop table t4; create table t1 (a year not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` year(4) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values ('1975'), (2020), ('1980'), ('2000'); select * from t1; a diff --git a/mysql-test/suite/parts/r/partition_datetime_myisam.result b/mysql-test/suite/parts/r/partition_datetime_myisam.result index 7e05d368cf8..4bb182281c4 100644 --- a/mysql-test/suite/parts/r/partition_datetime_myisam.result +++ b/mysql-test/suite/parts/r/partition_datetime_myisam.result @@ -1,23 +1,15 @@ create table t1 (a timestamp not null, primary key(a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59'); select * from t1; a @@ -281,24 +273,16 @@ a drop table t4; create table t1 (a date not null, primary key(a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values ('1975-01-01'), ('2020-12-31'), ('1980-10-14'), ('2000-06-15'); select * from t1; a @@ -608,24 +592,16 @@ a drop table t4; create table t1 (a time not null, primary key(a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` time NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values ('21:21:21'), ('12:10:30'), ('03:03:03'), ('23:59'); select * from t1; a @@ -1073,24 +1049,16 @@ a drop table t4; create table t1 (a datetime not null, primary key(a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` datetime NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values ('1975-01-01 21:21:21'), ('2020-12-31 12:10:30'), ('1980-10-14 03:03'), ('2000-06-15 23:59'); select * from t1; a @@ -1350,24 +1318,16 @@ a drop table t4; create table t1 (a year not null, primary key(a)) engine='MyISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` year(4) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values ('1975'), (2020), ('1980'), ('2000'); select * from t1; a diff --git a/mysql-test/suite/parts/r/partition_decimal_innodb.result b/mysql-test/suite/parts/r/partition_decimal_innodb.result index c0a165cf189..3aede5bb09b 100644 --- a/mysql-test/suite/parts/r/partition_decimal_innodb.result +++ b/mysql-test/suite/parts/r/partition_decimal_innodb.result @@ -1,23 +1,15 @@ create table t1 (a decimal(10,4) not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(10,4) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (999999.9999), (-999999.9999), (123456.7899), (-123456.7899), (-1.5), (1), (0), (-1), (1.5), (1234.567), (-1234.567); select * from t1; a diff --git a/mysql-test/suite/parts/r/partition_decimal_myisam.result b/mysql-test/suite/parts/r/partition_decimal_myisam.result index 4d06f4d7b38..4ed9b94d008 100644 --- a/mysql-test/suite/parts/r/partition_decimal_myisam.result +++ b/mysql-test/suite/parts/r/partition_decimal_myisam.result @@ -1,23 +1,15 @@ create table t1 (a decimal(10,4) not null, primary key(a)) engine='MYISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` decimal(10,4) NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (999999.9999), (-999999.9999), (123456.7899), (-123456.7899), (-1.5), (1), (0), (-1), (1.5), (1234.567), (-1234.567); select * from t1; a diff --git a/mysql-test/suite/parts/r/partition_float_innodb.result b/mysql-test/suite/parts/r/partition_float_innodb.result index c203fabfd87..8e1e1b51efd 100644 --- a/mysql-test/suite/parts/r/partition_float_innodb.result +++ b/mysql-test/suite/parts/r/partition_float_innodb.result @@ -1,23 +1,15 @@ create table t1 (a float not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` float NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (-3.402823466E+38), (3.402823466E+38), (-1.5), (-1), (0), (1), (1.5); select * from t1; a @@ -91,24 +83,16 @@ count(*) drop table t2; create table t1 (a double not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208); select * from t1; a diff --git a/mysql-test/suite/parts/r/partition_float_myisam.result b/mysql-test/suite/parts/r/partition_float_myisam.result index 13881548473..9abd0fb11cd 100644 --- a/mysql-test/suite/parts/r/partition_float_myisam.result +++ b/mysql-test/suite/parts/r/partition_float_myisam.result @@ -1,23 +1,15 @@ create table t1 (a float not null, primary key(a)) engine='MYISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` float NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (-3.402823466E+38), (3.402823466E+38), (-1.5), (-1), (0), (1), (1.5); select * from t1; a @@ -91,24 +83,16 @@ count(*) drop table t2; create table t1 (a double not null, primary key(a)) engine='MYISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` double NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (-2.2250738585072014E+208), (-2.2250738585072014E-208), (-1.5), (-1), (0), (1.5), (1234.567), (2.2250738585072014E+208); select * from t1; a diff --git a/mysql-test/suite/parts/r/partition_int_innodb.result b/mysql-test/suite/parts/r/partition_int_innodb.result index 8bc095b2886..9f1712e141e 100644 --- a/mysql-test/suite/parts/r/partition_int_innodb.result +++ b/mysql-test/suite/parts/r/partition_int_innodb.result @@ -1,23 +1,15 @@ create table t1 (a tinyint unsigned not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (255), (254), (253), (252), (1), (2), (128); select * from t1; a @@ -108,24 +100,16 @@ a drop table t3; create table t1 (a smallint unsigned not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` smallint(5) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256); select * from t1; a @@ -216,24 +200,16 @@ a drop table t3; create table t1 (a int unsigned not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(10) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (4294967295), (4294967294), (4294967293), (4294967292), (1), (2), (65535); select * from t1; a @@ -324,24 +300,16 @@ a drop table t3; create table t1 (a mediumint unsigned not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535); select * from t1; a @@ -432,24 +400,16 @@ a drop table t3; create table t1 (a bigint unsigned not null, primary key(a)) engine='InnoDB' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535); select * from t1; a diff --git a/mysql-test/suite/parts/r/partition_int_myisam.result b/mysql-test/suite/parts/r/partition_int_myisam.result index 7f16cdb207a..1e0ba724f4c 100644 --- a/mysql-test/suite/parts/r/partition_int_myisam.result +++ b/mysql-test/suite/parts/r/partition_int_myisam.result @@ -1,23 +1,15 @@ create table t1 (a tinyint unsigned not null, primary key(a)) engine='MYISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (255), (254), (253), (252), (1), (2), (128); select * from t1; a @@ -108,24 +100,16 @@ a drop table t3; create table t1 (a smallint unsigned not null, primary key(a)) engine='MYISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` smallint(5) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (65535), (65534), (65533), (65532), (1), (2), (256); select * from t1; a @@ -216,24 +200,16 @@ a drop table t3; create table t1 (a int unsigned not null, primary key(a)) engine='MYISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(10) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (4294967295), (4294967294), (4294967293), (4294967292), (1), (2), (65535); select * from t1; a @@ -324,24 +300,16 @@ a drop table t3; create table t1 (a mediumint unsigned not null, primary key(a)) engine='MYISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (16777215), (16777214), (16777213), (16777212), (1), (2), (65535); select * from t1; a @@ -432,24 +400,16 @@ a drop table t3; create table t1 (a bigint unsigned not null, primary key(a)) engine='MYISAM' partition by key (a) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` bigint(20) unsigned NOT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612), (1), (2), (65535); select * from t1; a diff --git a/mysql-test/suite/parts/r/partition_special_innodb.result b/mysql-test/suite/parts/r/partition_special_innodb.result index 4b139bb0f9e..fa1d2eb9994 100644 --- a/mysql-test/suite/parts/r/partition_special_innodb.result +++ b/mysql-test/suite/parts/r/partition_special_innodb.result @@ -1,17 +1,9 @@ create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w'), primary key(a,b,c,d)) engine='InnoDB' partition by key (a,b,c,d) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -20,7 +12,7 @@ t1 CREATE TABLE `t1` ( `c` varchar(50) NOT NULL, `d` enum('m','w') NOT NULL DEFAULT 'm', PRIMARY KEY (`a`,`b`,`c`,`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values ('1975-01-01', 'abcde', 'abcde','m'), ('1983-12-31', 'cdef', 'srtbvsr', 'w'), @@ -40,18 +32,10 @@ a b c d drop table t1; create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h)) engine='InnoDB' partition by key(a,b,c,d,e,f,g,h) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -65,7 +49,7 @@ t1 CREATE TABLE `t1` ( `h` tinyint(4) NOT NULL, `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'), @@ -85,18 +69,10 @@ a b c d e f g h i drop table t1; create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine='InnoDB' partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -118,7 +94,7 @@ t1 CREATE TABLE `t1` ( `h1` tinyint(4) NOT NULL, `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127,'1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'), @@ -138,33 +114,17 @@ a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 i drop table t1; create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3)) engine='InnoDB' partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); ERROR 42000: Too many key parts specified; max 16 parts allowed create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine='InnoDB' partition by key(a,b,c,d,e,f,g,h) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -202,7 +162,7 @@ t1 CREATE TABLE `t1` ( `h3` tinyint(4) NOT NULL, `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = InnoDB) */ +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = InnoDB, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = InnoDB, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = InnoDB, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = InnoDB) */ insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, '1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127,'1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, '1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, '1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'), diff --git a/mysql-test/suite/parts/r/partition_special_myisam.result b/mysql-test/suite/parts/r/partition_special_myisam.result index 85e6d5445fd..f0a66ac847f 100644 --- a/mysql-test/suite/parts/r/partition_special_myisam.result +++ b/mysql-test/suite/parts/r/partition_special_myisam.result @@ -1,17 +1,9 @@ create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w'), primary key(a,b,c,d)) engine='MyISAM' partition by key (a,b,c,d) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -20,7 +12,7 @@ t1 CREATE TABLE `t1` ( `c` varchar(50) NOT NULL, `d` enum('m','w') NOT NULL DEFAULT 'm', PRIMARY KEY (`a`,`b`,`c`,`d`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values ('1975-01-01', 'abcde', 'abcde','m'), ('1983-12-31', 'cdef', 'srtbvsr', 'w'), @@ -40,18 +32,10 @@ a b c d drop table t1; create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h)) engine='MyISAM' partition by key(a,b,c,d,e,f,g,h) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -65,7 +49,7 @@ t1 CREATE TABLE `t1` ( `h` tinyint(4) NOT NULL, `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'), @@ -85,18 +69,10 @@ a b c d e f g h i drop table t1; create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine='MyISAM' partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -118,7 +94,7 @@ t1 CREATE TABLE `t1` ( `h1` tinyint(4) NOT NULL, `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127,'1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'), @@ -138,33 +114,17 @@ a b c d e f g h a1 b1 c1 d1 e1 f1 g1 h1 i drop table t1; create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3)) engine='MyISAM' partition by key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1,a2,b2,c2,d2,e2,f2,g2,h2,a3,b3,c3,d3,e3,f3,g3,h3) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); ERROR 42000: Too many key parts specified; max 16 parts allowed create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, a1 date not null, b1 varchar(50) not null, c1 varchar(50) not null, d1 enum('m', 'w') not null, e1 int not null, f1 decimal (18,2) not null, g1 bigint not null, h1 tinyint not null, a2 date not null, b2 varchar(50) not null, c2 varchar(50) not null, d2 enum('m', 'w') not null, e2 int not null, f2 decimal (18,2) not null, g2 bigint not null, h2 tinyint not null, a3 date not null, b3 varchar(50) not null, c3 varchar(50) not null, d3 enum('m', 'w') not null, e3 int not null, f3 decimal (18,2) not null, g3 bigint not null, h3 tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h,a1,b1,c1,d1,e1,f1,g1,h1)) engine='MyISAM' partition by key(a,b,c,d,e,f,g,h) ( -partition pa1 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=20 min_rows=2, -partition pa2 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=3, -partition pa3 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=30 min_rows=4, -partition pa4 DATA DIRECTORY = -'/tmp' INDEX DIRECTORY = -'/tmp' max_rows=40 min_rows=2); +partition pa1 max_rows=20 min_rows=2, +partition pa2 max_rows=30 min_rows=3, +partition pa3 max_rows=30 min_rows=4, +partition pa4 max_rows=40 min_rows=2); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -202,7 +162,7 @@ t1 CREATE TABLE `t1` ( `h3` tinyint(4) NOT NULL, `i` char(255) DEFAULT NULL, PRIMARY KEY (`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`a1`,`b1`,`c1`,`d1`,`e1`,`f1`,`g1`,`h1`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */ +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a,b,c,d,e,f,g,h) (PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 ENGINE = MyISAM, PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 ENGINE = MyISAM, PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 ENGINE = MyISAM, PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 ENGINE = MyISAM) */ insert into t1 values ('1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113,'1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, '1975-01-01', 'abcde', 'abcde','m', 1234, 123.45, 32412341234, 113, 'tbhth nrzh ztfghgfh fzh ftzhj fztjh'), ('1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127,'1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, '1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, '1983-12-31', 'cdef', 'srtbvsr', 'w', 45634, 13452.56, 3452346456, 127, 'liuugbzvdmrlti b itiortudirtfgtibm dfi'), diff --git a/mysql-test/suite/parts/t/partition_basic_symlink_innodb.test b/mysql-test/suite/parts/t/partition_basic_symlink_innodb.test new file mode 100644 index 00000000000..9400e9ffe2b --- /dev/null +++ b/mysql-test/suite/parts/t/partition_basic_symlink_innodb.test @@ -0,0 +1,84 @@ +################################################################################ +# t/partition_basic_innodb.test # +# # +# Purpose: # +# Tests around Create Partitioned table using DATA/INDEX DIR # +# InnoDB branch # +# # +#------------------------------------------------------------------------------# +# Original Author: mleich # +# Original Date: 2006-03-05 # +# Change Author: mattiasj # +# Change Date: 2008-02-05 # +# Change: copied it from partition_basic_innodb.test and kept DATA DIR # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT INNODB SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# +# Please read the README at the end of inc/partition.pre before changing +# any of the variables. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +##### Options, for debugging support ##### +let $debug= 0; +let $with_partitioning= 1; + +##### Option, for displaying files ##### +let $ls= 1; + +##### Number of rows for the INSERT/UPDATE/DELETE/SELECT experiments ##### +# on partioned tables +SET @max_row = 20; + +##### Execute more tests ##### +let $more_trigger_tests= 0; +let $more_pk_ui_tests= 0; + +# The server must support partitioning. +--source include/have_partition.inc +# The server must support symlink for DATA/INDEX DIRECTORY. +--source include/have_symlink.inc +# windows does not support symlink for DATA/INDEX DIRECTORY. +--source include/not_windows.inc + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +--source include/have_innodb.inc +let $engine= 'InnoDB'; + +##### Execute the test of "table" files +# InnoDB has no files per PK, UI, ... +let $do_file_tests= 0; + +##### Execute PRIMARY KEY tests ##### +# AFAIK InnoDB clusters the table around PRIMARY KEYs. +let $do_pk_tests= 1; + +##### Assign a big number smaller than the maximum value for partitions ##### +# and smaller than the maximum value of SIGNED INTEGER +let $MAX_VALUE= (2147483646); + +# Generate the prerequisites ($variables, @variables, tables) needed +--source suite/parts/inc/partition.pre + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/parts/inc/partition_basic_symlink.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/parts/inc/partition_cleanup.inc diff --git a/mysql-test/suite/parts/t/partition_basic_symlink_myisam.test b/mysql-test/suite/parts/t/partition_basic_symlink_myisam.test new file mode 100644 index 00000000000..8a12f8e8b39 --- /dev/null +++ b/mysql-test/suite/parts/t/partition_basic_symlink_myisam.test @@ -0,0 +1,86 @@ +################################################################################ +# t/partition_basic_myisam.test # +# # +# Purpose: # +# Tests around Create Partitioned table using DATA/INDEX DIR # +# MyISAM branch # +# # +#------------------------------------------------------------------------------# +# Original Author: mleich # +# Original Date: 2006-03-05 # +# Change Author: mattiasj # +# Change Date: 2008-02-05 # +# Change: copied it from partition_basic_myisam.test and kept DATA DIR # +################################################################################ + +# +# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE ! +# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN +# THE SOURCED FILES ONLY. +# +# Please read the README at the end of inc/partition.pre before changing +# any of the variables. +# + +#------------------------------------------------------------------------------# +# General not engine specific settings and requirements + +##### Options, for debugging support ##### +let $debug= 0; +let $with_partitioning= 1; + +##### Option, for displaying files ##### +let $ls= 1; + +##### Number of rows for the INSERT/UPDATE/DELETE/SELECT experiments ##### +# on partioned tables +SET @max_row = 20; + +##### Execute more tests ##### +let $more_trigger_tests= 0; +let $more_pk_ui_tests= 0; + +# The server must support partitioning. +--source include/have_partition.inc +# The server must support symlink for DATA/INDEX DIRECTORY. +--source include/have_symlink.inc +# windows does not support symlink for DATA/INDEX DIRECTORY. +--source include/not_windows.inc + +#------------------------------------------------------------------------------# +# Engine specific settings and requirements + +##### Storage engine to be tested +let $engine= 'MyISAM'; +# The server uses in case of MyISAM symlinking (if available) and the expected +# results fit to symlinking support. +--source include/have_symlink.inc + +##### Execute the test of "table" files +# MyISAM has files per PK, UI, ... +let $do_file_tests= 1; + +##### Execute PRIMARY KEY tests ##### +# AFAIK MyISAM treats PRIMARY KEYs like UNIQUE INDEXes +let $do_pk_tests= 0; + +##### Assign a big number smaller than the maximum value for partitions ##### +# and smaller than the maximum value of SIGNED INTEGER +let $MAX_VALUE= (2147483646); + +# Generate the prerequisites ($variables, @variables, tables) needed +--source suite/parts/inc/partition.pre + +##### Workarounds for known open engine specific bugs +# none + +#------------------------------------------------------------------------------# +# Execute the tests to be applied to all storage engines +--source suite/parts/inc/partition_basic_symlink.inc + +#------------------------------------------------------------------------------# +# Execute storage engine specific tests + +#------------------------------------------------------------------------------# +# Cleanup +--source suite/parts/inc/partition_cleanup.inc diff --git a/mysql-test/suite/parts/t/partition_sessions.test b/mysql-test/suite/parts/t/partition_sessions.test index ef3c5ef6a97..3d59292bee5 100644 --- a/mysql-test/suite/parts/t/partition_sessions.test +++ b/mysql-test/suite/parts/t/partition_sessions.test @@ -27,27 +27,6 @@ f4 datetime; let $col_access_list = f1,f2,f3,f4 ; let $col_new_list = new.f1,new.f2,new.f3 new.f4 ; -#-------------------------------------------------- -# initialize directories for partitions -#-------------------------------------------------- - ---disable_query_log -# DATA DIRECTORY -# Make directory for partition data ---exec mkdir $MYSQLTEST_VARDIR/master-data/tmpdata || true -eval SET @data_dir = 'DATA DIRECTORY = -''$MYSQLTEST_VARDIR/master-data/tmpdata'''; -let $data_directory = `select @data_dir`; - -#INDEX DIRECTORY -# Make directory for partition index ---exec mkdir $MYSQLTEST_VARDIR/master-data/tmpindex || true -eval SET @indx_dir = 'INDEX DIRECTORY = -''$MYSQLTEST_VARDIR/master-data/tmpindex'''; -let $index_directory = `select @indx_dir`; ---enable_query_log - - #--------------------------------------------------- # Setting the parameters to use during testing #--------------------------------------------------- @@ -134,16 +113,16 @@ create table test_stat ( # tb3_eng1: key partitioning #---------------------------------------------------------------------- -#--replace_result $data_directory $index_directory $ENG1 ENG1 +#--replace_result $ENG1 ENG1 eval create table tb3_eng1 ( i1 int NOT NULL auto_increment, primary key (i1), $column_list ) engine=$ENG1 PARTITION BY KEY (i1) PARTITIONS 4 -(PARTITION part1 $data_directory $index_directory, -PARTITION part2 $data_directory $index_directory, -PARTITION part3 $data_directory $index_directory, -PARTITION part4 $data_directory $index_directory); +(PARTITION part1, +PARTITION part2, +PARTITION part3, +PARTITION part4); #--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR eval load data local infile '$MYSQL_TEST_DIR/suite/system_3/data/tb1.txt' diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index 7b4f95bbf8a..dd8c940ac44 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1773,4 +1773,15 @@ drop table t1; CREATE TABLE t1(a INT) ENGINE=CSV; SHOW WARNINGS; +# +# BUG#33067 - . +# +create table t1 (c1 tinyblob not null) engine=csv; +insert into t1 values("This"); +--enable_info +update t1 set c1="That" where c1="This"; +--disable_info +select * from t1; +drop table t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test index c80444daddd..b146dc63626 100644 --- a/mysql-test/t/ctype_ucs2_def.test +++ b/mysql-test/t/ctype_ucs2_def.test @@ -39,4 +39,17 @@ INSERT INTO t1 VALUES('A', 'A'), ('B', 'B'), ('C', 'C'); INSERT INTO t1 VALUES('A ', 'A '); DROP TABLE t1; +# +# Bug#32705 - myisam corruption: Key in wrong position +# at page 1024 with ucs2_bin +# +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; +DROP TABLE t1; + --echo End of 5.0 tests diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index fbd0a5ac4e7..21ffa0683b6 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -1278,5 +1278,189 @@ DELETE FROM t1 WHERE c1 >= 10; CHECK TABLE t1; DROP TABLE t1; +# +# Bug#33222 - myisam-table drops rows when column is added +# and a char-field > 128 exists +# +# Test #1 - CHECK TABLE sees wrong record, REPAR TABLE deletes it. +# Using a CHAR column that can have > 127 characters. +# Using a VARCHAR to create a table with dynamic row format. +CREATE TABLE t1 ( + c1 CHAR(130), + c2 VARCHAR(1) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES(REPEAT("a",128), 'b'); +SELECT COUNT(*) FROM t1; +CHECK TABLE t1; +REPAIR TABLE t1; +SELECT COUNT(*) FROM t1; +CHECK TABLE t1; +DROP TABLE t1; +# +# Test #2 - same as test #1, but using EXTENDED. +# Using a CHAR column that can have > 127 characters. +# Using a VARCHAR to create a table with dynamic row format. +CREATE TABLE t1 ( + c1 CHAR(130), + c2 VARCHAR(1) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES(REPEAT("a",128), 'b'); +SELECT COUNT(*) FROM t1; +CHECK TABLE t1 EXTENDED; +REPAIR TABLE t1 EXTENDED; +SELECT COUNT(*) FROM t1; +CHECK TABLE t1 EXTENDED; +DROP TABLE t1; +# +# Test #3 - same as test #1, but using OPTIMIZE TABLE. +# Using a CHAR column that can have > 127 characters. +# Using a VARCHAR to create a table with dynamic row format. +CREATE TABLE t1 ( + c1 CHAR(130), + c2 VARCHAR(1) +) ENGINE=MyISAM; +INSERT INTO t1 VALUES(REPEAT("a",128), 'b'); +# Insert more rows and delete one in the middle to force optimize. +INSERT INTO t1 VALUES('b', 'b'); +INSERT INTO t1 VALUES('c', 'b'); +DELETE FROM t1 WHERE c1='b'; +SELECT COUNT(*) FROM t1; +OPTIMIZE TABLE t1; +SELECT COUNT(*) FROM t1; +DROP TABLE t1; +# +# Test #4 - ALTER TABLE deletes rows. +# Using a CHAR column that can have > 127 characters. +# Using a VARCHAR to create a table with dynamic row format. +# Using an index which can be disabled during bulk insert. +CREATE TABLE t1 ( + c1 CHAR(130), + c2 VARCHAR(1), + KEY (c1) +) ENGINE=MyISAM; +# +# Insert 100 rows. This turns bulk insert on during the copy phase of +# ALTER TABLE. Bulk insert disables keys before the insert and re-enables +# them by repair after the insert. +--disable_query_log +let $count= 100; +--echo # Insert $count rows. Query log disabled. +while ($count) +{ + INSERT INTO t1 VALUES ('a', 'b'); + dec $count; +} +--enable_query_log +# +# Change most of the rows into long character values with > 127 characters. +UPDATE t1 SET c1=REPEAT("a",128) LIMIT 90; +SELECT COUNT(*) FROM t1; +ALTER TABLE t1 ENGINE=MyISAM; +# +# With bug present, this shows that all long rows are gone. +SELECT COUNT(*) FROM t1; +CHECK TABLE t1; +CHECK TABLE t1 EXTENDED; +DROP TABLE t1; +# +# Test #5 - same as test #1 but UTF-8. +# Using a CHAR column that can have > 127 characters. +# Using a VARCHAR to create a table with dynamic row format. +CREATE TABLE t1 ( + c1 CHAR(50), + c2 VARCHAR(1) +) ENGINE=MyISAM DEFAULT CHARSET UTF8; +# Using Tamil Letter A, Unicode U+0B85 +INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b'); +SELECT COUNT(*) FROM t1; +CHECK TABLE t1; +REPAIR TABLE t1; +SELECT COUNT(*) FROM t1; +CHECK TABLE t1; +DROP TABLE t1; +# +# Test #6 - same as test #2, but UTF-8. +# Using a CHAR column that can have > 127 characters. +# Using a VARCHAR to create a table with dynamic row format. +CREATE TABLE t1 ( + c1 CHAR(50), + c2 VARCHAR(1) +) ENGINE=MyISAM DEFAULT CHARSET UTF8; +# Using Tamil Letter A, Unicode U+0B85 +INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b'); +SELECT COUNT(*) FROM t1; +CHECK TABLE t1 EXTENDED; +REPAIR TABLE t1 EXTENDED; +SELECT COUNT(*) FROM t1; +CHECK TABLE t1 EXTENDED; +DROP TABLE t1; +# +# Test #7 - same as test #3, but UTF-8. +# Using a CHAR column that can have > 127 characters. +# Using a VARCHAR to create a table with dynamic row format. +CREATE TABLE t1 ( + c1 CHAR(50), + c2 VARCHAR(1) +) ENGINE=MyISAM DEFAULT CHARSET UTF8; +# Using Tamil Letter A, Unicode U+0B85 +INSERT INTO t1 VALUES(REPEAT(_utf8 x'e0ae85',43), 'b'); +# Insert more rows and delete one in the middle to force optimize. +INSERT INTO t1 VALUES('b', 'b'); +INSERT INTO t1 VALUES('c', 'b'); +DELETE FROM t1 WHERE c1='b'; +SELECT COUNT(*) FROM t1; +OPTIMIZE TABLE t1; +SELECT COUNT(*) FROM t1; +DROP TABLE t1; +# +# Test #8 - same as test #4, but UTF-8. +# Using a CHAR column that can have > 42 UTF-8 characters. +# Using a VARCHAR to create a table with dynamic row format. +# Using an index which can be disabled during bulk insert. +CREATE TABLE t1 ( + c1 CHAR(50), + c2 VARCHAR(1), + KEY (c1) +) ENGINE=MyISAM DEFAULT CHARSET UTF8; +# +# Insert 100 rows. This turns bulk insert on during the copy phase of +# ALTER TABLE. Bulk insert disables keys before the insert and re-enables +# them by repair after the insert. +--disable_query_log +let $count= 100; +--echo # Insert $count rows. Query log disabled. +while ($count) +{ + INSERT INTO t1 VALUES ('a', 'b'); + dec $count; +} +--enable_query_log +# +# Change most of the rows into long character values with > 42 characters. +# Using Tamil Letter A, Unicode U+0B85 +UPDATE t1 SET c1=REPEAT(_utf8 x'e0ae85',43) LIMIT 90; +SELECT COUNT(*) FROM t1; +ALTER TABLE t1 ENGINE=MyISAM; +# +# With bug present, this shows that all long rows are gone. +SELECT COUNT(*) FROM t1; +CHECK TABLE t1; +CHECK TABLE t1 EXTENDED; +DROP TABLE t1; + +# +# Bug#29182 - MyISAMCHK reports wrong character set +# +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; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--exec $MYISAMCHK -d $MYSQLTEST_VARDIR/master-data/test/t1 +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 23d6c5f8865..1dd3e4801bc 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -14,6 +14,10 @@ drop table if exists t1; --enable_warnings +--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED +create table t1 (a int) partition by list ((a/3)*10 div 1) +(partition p0 values in (0), partition p1 values in (1)); + # # Bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash. # @@ -78,24 +82,6 @@ create table t1 (a int) partition by key(a) partitions 1e+300; -# -# Bug 21350: Data Directory problems -# --- error ER_WRONG_TABLE_NAME -create table t1 (a int) -partition by key (a) -(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); - -# -# Insert a test that manages to create the first partition and fails with -# the second, ensure that we clean up afterwards in a proper manner. -# ---error ER_WRONG_TABLE_NAME -create table t1 (a int) -partition by key (a) -(partition p0, - partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); - # # Bug 19309 Partitions: Crash if double procedural alter # @@ -1398,35 +1384,6 @@ SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified' drop table t1, t2; -# -# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables -# - -disable_query_log; -eval create table t2 (i int ) -partition by range (i) -( - partition p01 values less than (1000) - data directory="$MYSQLTEST_VARDIR/master-data/test/" - index directory="$MYSQLTEST_VARDIR/master-data/test/" -); -enable_query_log; - -set @org_mode=@@sql_mode; -set @@sql_mode='NO_DIR_IN_CREATE'; -select @@sql_mode; -create table t1 (i int ) -partition by range (i) -( - partition p01 values less than (1000) - data directory='/not/existing' - index directory='/not/existing' -); - -show create table t2; -DROP TABLE t1, t2; -set @@sql_mode=@org_mode; - # # Bug #27123 partition + on duplicate key update + varchar = Can't find record in # diff --git a/mysql-test/t/partition_datatype.test b/mysql-test/t/partition_datatype.test index 61d3cb42c7b..c21fb40f735 100644 --- a/mysql-test/t/partition_datatype.test +++ b/mysql-test/t/partition_datatype.test @@ -11,11 +11,11 @@ drop table if exists t1; --enable_warnings -# FIXME: disabled this test because of valgrind error -#create table t1 (a bit not null) partition by key (a); -#insert into t1 values (b'1'); -#select * from t1 where a = b'1'; -#drop table t1; +-- echo # test with not null +create table t1 (a bit not null) partition by key (a); +insert into t1 values (b'1'); +select hex(a) from t1 where a = b'1'; +drop table t1; create table t1 (a tinyint not null) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; @@ -37,14 +37,14 @@ insert into t1 values (2); select * from t1 where a = 2; drop table t1; create table t1 (a float not null) partition by key (a); -insert into t1 values (2.1); -select * from t1 where a = 2.1; +insert into t1 values (0.5); +select * from t1 where a = 0.5; drop table t1; create table t1 (a double not null) partition by key (a); -insert into t1 values (2.1); -select * from t1 where a = 2.1; +insert into t1 values (0.5); +select * from t1 where a = 0.5; drop table t1; -create table t1 (a decimal not null) partition by key (a); +create table t1 (a decimal(4,2) not null) partition by key (a); insert into t1 values (2.1); select * from t1 where a = 2.1; drop table t1; @@ -100,11 +100,11 @@ create table t1 (a set('y','n') not null) partition by key (a); insert into t1 values ('y'); select * from t1 where a = 'y'; drop table t1; -# FIXME: disabled this test because of valgrind error -#create table t1 (a bit) partition by key (a); -#insert into t1 values (b'1'); -#select * from t1 where a = b'1'; -#drop table t1; +-- echo # test with null allowed +create table t1 (a bit) partition by key (a); +insert into t1 values (b'1'); +select hex(a) from t1 where a = b'1'; +drop table t1; create table t1 (a tinyint) partition by key (a); insert into t1 values (2); select * from t1 where a = 2; @@ -126,14 +126,14 @@ insert into t1 values (2); select * from t1 where a = 2; drop table t1; create table t1 (a float) partition by key (a); -insert into t1 values (2.1); -select * from t1 where a = 2.1; +insert into t1 values (0.5); +select * from t1 where a = 0.5; drop table t1; create table t1 (a double) partition by key (a); -insert into t1 values (2.1); -select * from t1 where a = 2.1; +insert into t1 values (0.5); +select * from t1 where a = 0.5; drop table t1; -create table t1 (a decimal) partition by key (a); +create table t1 (a decimal(4,2)) partition by key (a); insert into t1 values (2.1); select * from t1 where a = 2.1; drop table t1; @@ -192,18 +192,23 @@ drop table t1; create table t1 (a varchar(65531)) partition by key (a); insert into t1 values ('bbbb'); insert into t1 values ('aaaa'); -select * from t1 where a = 'aaa%'; +select * from t1 where a = 'aaaa'; select * from t1 where a like 'aaa%'; +select * from t1 where a = 'bbbb'; drop table t1; create table t1 (a varchar(65532)) partition by key (a); insert into t1 values ('bbbb'); insert into t1 values ('aaaa'); -select * from t1 where a = 'aaa%'; +select * from t1 where a = 'aaaa'; select * from t1 where a like 'aaa%'; +select * from t1 where a = 'bbbb'; drop table t1; create table t1 (a varchar(65533) not null) partition by key (a); +insert into t1 values ('bbbb'); insert into t1 values ('aaaa'); -select * from t1 where a = 'aaa%'; +select * from t1 where a = 'aaaa'; +select * from t1 where a like 'aaa%'; +select * from t1 where a = 'bbbb'; drop table t1; -- error ER_TOO_BIG_ROWSIZE create table t1 (a varchar(65533)) partition by key (a); @@ -211,3 +216,14 @@ create table t1 (a varchar(65533)) partition by key (a); create table t1 (a varchar(65534) not null) partition by key (a); -- error ER_TOO_BIG_ROWSIZE create table t1 (a varchar(65535)) partition by key (a); + +# +# Bug#34358: error in key_restore for bitfields with uneven bits +# +create table t1 (a bit(27), primary key (a)) engine=myisam +partition by hash (a) +(partition p0, partition p1, partition p2); +show create table t1; +insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34); +select hex(a) from t1 where a = 7; +drop table t1; diff --git a/mysql-test/t/partition_range.test b/mysql-test/t/partition_range.test index c73a56aff9d..bc4231d1d71 100644 --- a/mysql-test/t/partition_range.test +++ b/mysql-test/t/partition_range.test @@ -10,6 +10,16 @@ drop table if exists t1, t2; --enable_warnings # +# BUG 33429: Succeeds in adding partition when maxvalue on last partition +# +create table t1 (a int) +partition by range (a) +( partition p0 values less than (maxvalue)); +--error ER_PARTITION_MAXVALUE_ERROR +alter table t1 add partition (partition p1 values less than (100000)); +show create table t1; +drop table t1; + # BUG 32943: # Locking problems in relation to partitioning and triggers # Also fixes and test cases of generic lock issues with diff --git a/mysql-test/t/partition_symlink.test b/mysql-test/t/partition_symlink.test index ab779ec2b68..ec809a34090 100644 --- a/mysql-test/t/partition_symlink.test +++ b/mysql-test/t/partition_symlink.test @@ -2,7 +2,9 @@ # (DATA/INDEX DIR requires symlinks) -- source include/have_partition.inc -- source include/have_symlink.inc -# remove the not_windows line after fixing bug#30459 +# remove the not_windows line after fixing bug#33687 +# symlinks must also work for files, not only directories +# as in --skip-symbolic-links -- source include/not_windows.inc -- disable_warnings DROP TABLE IF EXISTS t1; @@ -118,4 +120,50 @@ connection default; DROP USER mysqltest_1@localhost; disconnect con1; +# +# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables +# + +disable_query_log; +eval create table t2 (i int ) +partition by range (i) +( + partition p01 values less than (1000) + data directory="$MYSQLTEST_VARDIR/master-data/test/" + index directory="$MYSQLTEST_VARDIR/master-data/test/" +); +enable_query_log; + +set @org_mode=@@sql_mode; +set @@sql_mode='NO_DIR_IN_CREATE'; +select @@sql_mode; +create table t1 (i int ) +partition by range (i) +( + partition p01 values less than (1000) + data directory='/not/existing' + index directory='/not/existing' +); + +show create table t2; +DROP TABLE t1, t2; +set @@sql_mode=@org_mode; + +# +# Bug 21350: Data Directory problems +# +-- error ER_WRONG_TABLE_NAME +create table t1 (a int) +partition by key (a) +(partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); + +# +# Insert a test that manages to create the first partition and fails with +# the second, ensure that we clean up afterwards in a proper manner. +# +--error ER_WRONG_TABLE_NAME +create table t1 (a int) +partition by key (a) +(partition p0, + partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); diff --git a/mysql-test/t/partition_windows.test b/mysql-test/t/partition_windows.test index a0723feac44..d42a7383c99 100644 --- a/mysql-test/t/partition_windows.test +++ b/mysql-test/t/partition_windows.test @@ -7,23 +7,34 @@ # # Bug 25141: Crash Server on Partitioning command # +# Bug#30459: Partitioning across disks failing on Windows +# updated this test, since symlinked files are not supported on Windows +# (not the same as symlinked directories that have a special hack +# on windows). This test is not dependent on have_symlink. --disable_warnings -DROP TABLE IF EXISTS `example`; +DROP TABLE IF EXISTS t1; --enable_warnings ---disable_abort_on_error -CREATE TABLE `example` ( - `ID_EXAMPLE` int(10) unsigned NOT NULL AUTO_INCREMENT, - `DESCRIPTION` varchar(30) NOT NULL, - `LEVEL` smallint(5) unsigned DEFAULT NULL, - PRIMARY KEY (`ID_EXAMPLE`) +CREATE TABLE t1 ( + c1 int(10) unsigned NOT NULL AUTO_INCREMENT, + c2 varchar(30) NOT NULL, + c3 smallint(5) unsigned DEFAULT NULL, + PRIMARY KEY (c1) ) ENGINE = MYISAM -PARTITION BY HASH(ID_EXAMPLE)( -PARTITION p0 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p0Data', -PARTITION p1 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p1Data', -PARTITION p2 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p2Data', -PARTITION p3 DATA DIRECTORY = 'C:/build/5.1/data/partitiontest/p3Data' +PARTITION BY HASH(c1)( + PARTITION p0 + DATA DIRECTORY = 'C:/mysqltest/p0Data' + INDEX DIRECTORY = 'D:/mysqltest/p0Index', + PARTITION p1, + PARTITION p2 + DATA DIRECTORY = 'E:/mysqltest/p2Data' + INDEX DIRECTORY = 'F:/mysqltest/p2Index' ); ---enable_abort_on_error +INSERT INTO t1 VALUES (NULL, "first", 1); +INSERT INTO t1 VALUES (NULL, "second", 2); +INSERT INTO t1 VALUES (NULL, "third", 3); +ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index'); +INSERT INTO t1 VALUES (NULL, "last", 4); +DROP TABLE t1; diff --git a/mysql-test/t/plugin_load-master.opt b/mysql-test/t/plugin_load-master.opt new file mode 100644 index 00000000000..66637841f16 --- /dev/null +++ b/mysql-test/t/plugin_load-master.opt @@ -0,0 +1,3 @@ +$EXAMPLE_PLUGIN_OPT +"--plugin-load=;EXAMPLE=ha_example.so;" +--loose-plugin-example-enum-var=e2 diff --git a/mysql-test/t/plugin_load.test b/mysql-test/t/plugin_load.test new file mode 100644 index 00000000000..8555247dd71 --- /dev/null +++ b/mysql-test/t/plugin_load.test @@ -0,0 +1,3 @@ +--source include/have_example_plugin.inc + +SELECT @@global.example_enum_var = 'e2'; diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index f339b29c83a..eaad45d7d5d 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -226,3 +226,15 @@ USE test; --echo End of 5.0 tests + +# +# BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is +# silently ignored +# +SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE'; +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp'; +DROP TABLE t1; +SET @@SQL_MODE=@OLD_SQL_MODE; + +--echo End of 5.1 tests diff --git a/mysys/base64.c b/mysys/base64.c index dbe8927290d..6157dcaa5af 100644 --- a/mysys/base64.c +++ b/mysys/base64.c @@ -256,6 +256,7 @@ main(void) char * str; char * dst; + require(src); for (j= 0; jcoll->hash_sort(cs, tmp, 8, nr, nr2); + } +} + + size_t Field_bit::do_last_null_byte() const { diff --git a/sql/field.h b/sql/field.h index a6a1d8bfabc..38a0b1d5bbd 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1904,6 +1904,7 @@ public: Field::move_field_offset(ptr_diff); bit_ptr= ADD_TO_PTR(bit_ptr, ptr_diff, uchar*); } + void hash(ulong *nr, ulong *nr2); private: virtual size_t do_last_null_byte() const; diff --git a/sql/item_func.h b/sql/item_func.h index e09b584de95..c73b46f21e6 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -296,7 +296,6 @@ class Item_num_op :public Item_func_numhybrid void print(String *str) { print_op(str); } void find_num_type(); String *str_op(String *str) { DBUG_ASSERT(0); return 0; } - bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -382,6 +381,7 @@ class Item_func_additive_op :public Item_num_op public: Item_func_additive_op(Item *a,Item *b) :Item_num_op(a,b) {} void result_precision(); + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -416,6 +416,7 @@ public: double real_op(); my_decimal *decimal_op(my_decimal *); void result_precision(); + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -456,6 +457,7 @@ public: const char *func_name() const { return "%"; } void result_precision(); void fix_length_and_dec(); + bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; diff --git a/sql/key.cc b/sql/key.cc index 7f075674ab6..47e5c5ebdd7 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -168,6 +168,7 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info, } for (key_part= key_info->key_part ; (int) key_length > 0 ; key_part++) { + uchar used_uneven_bits= 0; if (key_part->null_bit) { if (*from_key++) @@ -186,6 +187,8 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info, set_rec_bits(bits, to_record + key_part->null_offset + (key_part->null_bit == 128), field->bit_ofs, field->bit_len); + /* we have now used the byte with 'uneven' bits */ + used_uneven_bits= 1; } } if (key_part->key_part_flag & HA_BLOB_PART) @@ -222,7 +225,9 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info, else { length= min(key_length, key_part->length); - memcpy(to_record + key_part->offset, from_key, (size_t) length); + /* skip the byte with 'uneven' bits, if used */ + memcpy(to_record + key_part->offset, from_key + used_uneven_bits + , (size_t) length - used_uneven_bits); } from_key+= length; key_length-= length; diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 3b580422da1..16433497efd 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -794,8 +794,18 @@ bool partition_info::check_partition_info(THD *thd, handlerton **eng_type, partition_element *part_elem= part_it++; if (part_elem->engine_type == NULL) part_elem->engine_type= default_engine_type; - if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) - part_elem->data_file_name= part_elem->index_file_name= 0; +#ifdef HAVE_READLINK + if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)) +#endif + { + if (part_elem->data_file_name) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, + "DATA DIRECTORY option ignored"); + if (part_elem->index_file_name) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, + "INDEX DIRECTORY option ignored"); + part_elem->data_file_name= part_elem->index_file_name= NULL; + } if (!is_sub_partitioned()) { if (check_table_name(part_elem->partition_name, diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 589ee8b2605..b4f7ce36ee5 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -118,11 +118,14 @@ void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status) } -#define get_object(p, obj) \ +#define get_object(p, obj, msg) \ {\ uint len = (uint)*p++; \ if (p + len > p_end || len >= sizeof(obj)) \ + {\ + errmsg= msg;\ goto err; \ + }\ strmake(obj,(char*) p,len); \ p+= len; \ }\ @@ -168,6 +171,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) int res; SLAVE_INFO *si; uchar *p= packet, *p_end= packet + packet_length; + const char *errmsg= "Wrong parameters to function register_slave"; if (check_access(thd, REPL_SLAVE_ACL, any_db,0,0,0,0)) return 1; @@ -176,9 +180,9 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) thd->server_id= si->server_id= uint4korr(p); p+= 4; - get_object(p,si->host); - get_object(p,si->user); - get_object(p,si->password); + get_object(p,si->host, "Failed to register slave: too long 'report-host'"); + get_object(p,si->user, "Failed to register slave: too long 'report-user'"); + get_object(p,si->password, "Failed to register slave; too long 'report-password'"); if (p+10 > p_end) goto err; si->port= uint2korr(p); @@ -197,8 +201,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) err: my_free(si, MYF(MY_WME)); - my_message(ER_UNKNOWN_ERROR, "Wrong parameters to function register_slave", - MYF(0)); + my_message(ER_UNKNOWN_ERROR, errmsg, MYF(0)); err2: return 1; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ecee3fcb97f..2e684f88374 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2356,15 +2356,7 @@ mysql_execute_command(THD *thd) /* Might have been updated in create_table_precheck */ create_info.alias= create_table->alias; -#ifndef HAVE_READLINK - if (create_info.data_file_name) - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, - "DATA DIRECTORY option ignored"); - if (create_info.index_file_name) - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, - "INDEX DIRECTORY option ignored"); - create_info.data_file_name= create_info.index_file_name= NULL; -#else +#ifdef HAVE_READLINK /* Fix names if symlinked tables */ if (append_file_to_dir(thd, &create_info.data_file_name, create_table->table_name) || diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 3f65baa71ff..8a22193863f 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4313,7 +4313,12 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, { my_error(ER_NO_BINLOG_ERROR, MYF(0)); DBUG_RETURN(TRUE); - } + } + if (tab_part_info->defined_max_value) + { + my_error(ER_PARTITION_MAXVALUE_ERROR, MYF(0)); + DBUG_RETURN(TRUE); + } if (no_new_partitions == 0) { my_error(ER_ADD_PARTITION_NO_NEW_PARTITION, MYF(0)); diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 2a86844c8c6..bae4a85fd8a 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1181,9 +1181,8 @@ int plugin_init(int *argc, char **argv, int flags) /* Register all dynamic plugins */ if (!(flags & PLUGIN_INIT_SKIP_DYNAMIC_LOADING)) { - if (opt_plugin_load && - plugin_load_list(&tmp_root, argc, argv, opt_plugin_load)) - goto err; + if (opt_plugin_load) + plugin_load_list(&tmp_root, argc, argv, opt_plugin_load); if (!(flags & PLUGIN_INIT_SKIP_PLUGIN_TABLE)) plugin_load(&tmp_root, argc, argv); } @@ -1412,7 +1411,11 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv, while (list) { if (p == buffer + sizeof(buffer) - 1) - break; + { + sql_print_error("plugin-load parameter too long"); + DBUG_RETURN(TRUE); + } + switch ((*(p++)= *(list++))) { case '\0': list= NULL; /* terminate the loop */ @@ -1421,10 +1424,17 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv, case ':': /* can't use this as delimiter as it may be drive letter */ #endif case ';': - name.str[name.length]= '\0'; - if (str != &dl) // load all plugins in named module + str->str[str->length]= '\0'; + if (str == &name) // load all plugins in named module { + if (!name.length) + { + p--; /* reset pointer */ + continue; + } + dl= name; + pthread_mutex_lock(&LOCK_plugin); if ((plugin_dl= plugin_dl_add(&dl, REPORT_TO_LOG))) { for (plugin= plugin_dl->plugins; plugin->info; plugin++) @@ -1434,7 +1444,10 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv, free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE)); if (plugin_add(tmp_root, &name, &dl, argc, argv, REPORT_TO_LOG)) + { + pthread_mutex_unlock(&LOCK_plugin); goto error; + } } plugin_dl_del(&dl); // reduce ref count } @@ -1442,9 +1455,14 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv, else { free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE)); + pthread_mutex_lock(&LOCK_plugin); if (plugin_add(tmp_root, &name, &dl, argc, argv, REPORT_TO_LOG)) + { + pthread_mutex_unlock(&LOCK_plugin); goto error; + } } + pthread_mutex_unlock(&LOCK_plugin); name.length= dl.length= 0; dl.str= NULL; name.str= p= buffer; str= &name; @@ -1453,6 +1471,7 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv, case '#': if (str == &name) { + name.str[name.length]= '\0'; str= &dl; str->str= p; continue; @@ -2999,7 +3018,8 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp, DBUG_RETURN(-1); } - if (opt->flags & PLUGIN_VAR_NOCMDOPT) + if ((opt->flags & (PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_THDLOCAL)) + == PLUGIN_VAR_NOCMDOPT) continue; if (!opt->name) @@ -3009,7 +3029,7 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp, DBUG_RETURN(-1); } - if (!(v= find_bookmark(name, opt->name, opt->flags))) + if (!(opt->flags & PLUGIN_VAR_THDLOCAL)) { optnamelen= strlen(opt->name); optname= (char*) alloc_root(mem_root, namelen + optnamelen + 2); @@ -3017,7 +3037,23 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp, optnamelen= namelen + optnamelen + 1; } else - optname= (char*) memdup_root(mem_root, v->key + 1, (optnamelen= v->name_len) + 1); + { + /* this should not fail because register_var should create entry */ + if (!(v= find_bookmark(name, opt->name, opt->flags))) + { + sql_print_error("Thread local variable '%s' not allocated " + "in plugin '%s'.", opt->name, plugin_name); + DBUG_RETURN(-1); + } + + *(int*)(opt + 1)= offset= v->offset; + + if (opt->flags & PLUGIN_VAR_NOCMDOPT) + continue; + + optname= (char*) memdup_root(mem_root, v->key + 1, + (optnamelen= v->name_len) + 1); + } /* convert '_' to '-' */ for (p= optname; *p; p++) @@ -3029,20 +3065,13 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp, options->app_type= opt; options->id= (options-1)->id + 1; - if (opt->flags & PLUGIN_VAR_THDLOCAL) - *(int*)(opt + 1)= offset= v->offset; - plugin_opt_set_limits(options, opt); - if ((opt->flags & PLUGIN_VAR_TYPEMASK) != PLUGIN_VAR_ENUM && - (opt->flags & PLUGIN_VAR_TYPEMASK) != PLUGIN_VAR_SET) - { - if (opt->flags & PLUGIN_VAR_THDLOCAL) - options->value= options->u_max_value= (uchar**) - (global_system_variables.dynamic_variables_ptr + offset); - else - options->value= options->u_max_value= *(uchar***) (opt + 1); - } + if (opt->flags & PLUGIN_VAR_THDLOCAL) + options->value= options->u_max_value= (uchar**) + (global_system_variables.dynamic_variables_ptr + offset); + else + options->value= options->u_max_value= *(uchar***) (opt + 1); options[1]= options[0]; options[1].name= p= (char*) alloc_root(mem_root, optnamelen + 8); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index a0464d43372..553ce9b3f1a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3484,8 +3484,18 @@ bool mysql_create_table_no_lock(THD *thd, thd_proc_info(thd, "creating table"); create_info->table_existed= 0; // Mark that table is created - if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) +#ifdef HAVE_READLINK + if (!my_use_symdir || (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)) +#endif + { + if (create_info->data_file_name) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, + "DATA DIRECTORY option ignored"); + if (create_info->index_file_name) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0, + "INDEX DIRECTORY option ignored"); create_info->data_file_name= create_info->index_file_name= 0; + } create_info->table_options=db_options; path[path_length - reg_ext_length]= '\0'; // Remove .frm extension diff --git a/sql/table.cc b/sql/table.cc index cacb3a94582..100821f28d5 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -892,26 +892,31 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ha_legacy_type(share->db_type()))); } #ifdef WITH_PARTITION_STORAGE_ENGINE - else + else if (str_db_type_length == 9 && + !strncmp((char *) next_chunk + 2, "partition", 9)) { - LEX_STRING pname= { C_STRING_WITH_LEN( "partition" ) }; - if (str_db_type_length == pname.length && - !strncmp((char *) next_chunk + 2, pname.str, pname.length)) - { - /* - Use partition handler - tmp_plugin is locked with a local lock. - we unlock the old value of share->db_plugin before - replacing it with a globally locked version of tmp_plugin - */ - plugin_unlock(NULL, share->db_plugin); - share->db_plugin= ha_lock_engine(NULL, partition_hton); - DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)", - str_db_type_length, next_chunk + 2, - ha_legacy_type(share->db_type()))); - } + /* + Use partition handler + tmp_plugin is locked with a local lock. + we unlock the old value of share->db_plugin before + replacing it with a globally locked version of tmp_plugin + */ + plugin_unlock(NULL, share->db_plugin); + share->db_plugin= ha_lock_engine(NULL, partition_hton); + DBUG_PRINT("info", ("setting dbtype to '%.*s' (%d)", + str_db_type_length, next_chunk + 2, + ha_legacy_type(share->db_type()))); } #endif + else if (!tmp_plugin) + { + /* purecov: begin inspected */ + error= 8; + my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), name.str); + my_free(buff, MYF(0)); + goto err; + /* purecov: end */ + } next_chunk+= str_db_type_length + 2; } if (next_chunk + 5 < buff_end) @@ -2200,6 +2205,8 @@ void open_table_error(TABLE_SHARE *share, int error, int db_errno, int errarg) "of MySQL and cannot be read", MYF(0), buff); break; + case 8: + break; default: /* Better wrong error than none */ case 4: strxmov(buff, share->normalized_path.str, reg_ext, NullS); diff --git a/storage/archive/azio.c b/storage/archive/azio.c index cada6c57918..59fbe2182ee 100644 --- a/storage/archive/azio.c +++ b/storage/archive/azio.c @@ -225,11 +225,17 @@ int get_byte(s) if (s->stream.avail_in == 0) { errno = 0; - s->stream.avail_in = my_read(s->file, (uchar *)s->inbuf, AZ_BUFSIZE_READ, MYF(0)); + s->stream.avail_in= (uInt) my_read(s->file, (uchar *)s->inbuf, + AZ_BUFSIZE_READ, MYF(0)); if (s->stream.avail_in == 0) { s->z_eof = 1; - /* if (ferror(s->file)) s->z_err = Z_ERRNO; */ + return EOF; + } + else if (s->stream.avail_in == (uInt) -1) + { + s->z_eof= 1; + s->z_err= Z_ERRNO; return EOF; } s->stream.next_in = s->inbuf; diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index c9fab79a4c5..f8dd778045f 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -56,6 +56,7 @@ TODO: #define META_BUFFER_SIZE sizeof(uchar) + sizeof(uchar) + sizeof(ulonglong) \ + sizeof(ulonglong) + sizeof(ulonglong) + sizeof(ulonglong) + sizeof(uchar) #define TINA_CHECK_HEADER 254 // The number we use to determine corruption +#define BLOB_MEMROOT_ALLOC_SIZE 8192 /* The file extension */ #define CSV_EXT ".CSV" // The data file @@ -597,6 +598,8 @@ int ha_tina::find_current_row(uchar *buf) bool read_all; DBUG_ENTER("ha_tina::find_current_row"); + free_root(&blobroot, MYF(MY_MARK_BLOCKS_FREE)); + /* We do not read further then local_saved_data_file_length in order not to conflict with undergoing concurrent insert. @@ -684,6 +687,22 @@ int ha_tina::find_current_row(uchar *buf) if ((*field)->store(buffer.ptr(), buffer.length(), buffer.charset(), CHECK_FIELD_WARN)) goto err; + if ((*field)->flags & BLOB_FLAG) + { + Field_blob *blob= *(Field_blob**) field; + uchar *src, *tgt; + uint length, packlength; + + packlength= blob->pack_length_no_ptr(); + length= blob->get_length(blob->ptr); + memcpy_fixed(&src, blob->ptr + packlength, sizeof(char*)); + if (src) + { + tgt= (uchar*) alloc_root(&blobroot, length); + bmove(tgt, src, length); + memcpy_fixed(blob->ptr + packlength, &tgt, sizeof(char*)); + } + } } } next_position= end_offset + eoln_len; @@ -914,9 +933,10 @@ int ha_tina::open_update_temp_file_if_needed() int ha_tina::update_row(const uchar * old_data, uchar * new_data) { int size; + int rc= -1; DBUG_ENTER("ha_tina::update_row"); - ha_statistic_increment(&SSV::ha_read_rnd_next_count); + ha_statistic_increment(&SSV::ha_update_count); if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) table->timestamp_field->set_time(); @@ -931,20 +951,23 @@ int ha_tina::update_row(const uchar * old_data, uchar * new_data) The temp_file_length is used to calculate new data file length. */ if (chain_append()) - DBUG_RETURN(-1); + goto err; if (open_update_temp_file_if_needed()) - DBUG_RETURN(-1); + goto err; if (my_write(update_temp_file, (uchar*)buffer.ptr(), size, MYF(MY_WME | MY_NABP))) - DBUG_RETURN(-1); + goto err; temp_file_length+= size; + rc= 0; /* UPDATE should never happen on the log tables */ DBUG_ASSERT(!share->is_log_table); - DBUG_RETURN(0); +err: + DBUG_PRINT("info",("rc = %d", rc)); + DBUG_RETURN(rc); } @@ -1050,6 +1073,8 @@ int ha_tina::rnd_init(bool scan) records_is_known= 0; chain_ptr= chain; + init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); + DBUG_RETURN(0); } @@ -1115,7 +1140,7 @@ void ha_tina::position(const uchar *record) int ha_tina::rnd_pos(uchar * buf, uchar *pos) { DBUG_ENTER("ha_tina::rnd_pos"); - ha_statistic_increment(&SSV::ha_read_rnd_next_count); + ha_statistic_increment(&SSV::ha_read_rnd_count); current_position= (off_t)my_get_ptr(pos,ref_length); DBUG_RETURN(find_current_row(buf)); } @@ -1179,6 +1204,7 @@ int ha_tina::rnd_end() off_t file_buffer_start= 0; DBUG_ENTER("ha_tina::rnd_end"); + free_root(&blobroot, MYF(0)); records_is_known= 1; if ((chain_ptr - chain) > 0) @@ -1350,6 +1376,8 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) /* set current position to the beginning of the file */ current_position= next_position= 0; + init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); + /* Read the file row-by-row. If everything is ok, repair is not needed. */ while (!(rc= find_current_row(buf))) { @@ -1358,6 +1386,8 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) current_position= next_position; } + free_root(&blobroot, MYF(0)); + my_free((char*)buf, MYF(0)); if (rc == HA_ERR_END_OF_FILE) @@ -1535,6 +1565,9 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt) local_saved_data_file_length= share->saved_data_file_length; /* set current position to the beginning of the file */ current_position= next_position= 0; + + init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); + /* Read the file row-by-row. If everything is ok, repair is not needed. */ while (!(rc= find_current_row(buf))) { @@ -1542,6 +1575,8 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt) count--; current_position= next_position; } + + free_root(&blobroot, MYF(0)); my_free((char*)buf, MYF(0)); thd_proc_info(thd, old_proc_info); diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 5ce09783b9b..5b4381396fc 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -82,6 +82,7 @@ class ha_tina: public handler uint32 chain_size; uint local_data_file_version; /* Saved version of the data file used */ bool records_is_known; + MEM_ROOT blobroot; private: bool get_write_pos(off_t *end_pos, tina_set *closest_hole); diff --git a/storage/myisam/ft_static.c b/storage/myisam/ft_static.c index 610c20eede6..1b6c7458fd7 100644 --- a/storage/myisam/ft_static.c +++ b/storage/myisam/ft_static.c @@ -608,7 +608,6 @@ const char *ft_precompiled_stopwords[] = { "won't", "wonder", "would", - "would", "wouldn't", "yes", "yet", diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index e74464a1834..dfb36700288 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1859,6 +1859,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg, share->avg_row_length); create_info.data_file_name= ha_create_info->data_file_name; create_info.index_file_name= ha_create_info->index_file_name; + create_info.language= share->table_charset->number; if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE) create_flags|= HA_CREATE_TMP_TABLE; diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 9940cf62204..22fa3d18802 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -1006,12 +1006,12 @@ uint _mi_rec_pack(MI_INFO *info, register uchar *to, { if (rec->length > 255 && new_length > 127) { - to[0]=(char) ((new_length & 127)+128); - to[1]=(char) (new_length >> 7); - to+=2; - } - else - *to++= (char) new_length; + to[0]= (uchar) ((new_length & 127) + 128); + to[1]= (uchar) (new_length >> 7); + to+=2; + } + else + *to++= (uchar) new_length; memcpy((uchar*) to,pos,(size_t) new_length); to+=new_length; flag|=bit; } @@ -1045,7 +1045,7 @@ uint _mi_rec_pack(MI_INFO *info, register uchar *to, } if ((bit= bit << 1) >= 256) { - *packpos++ = (char) (uchar) flag; + *packpos++= (uchar) flag; bit=1; flag=0; } } @@ -1055,9 +1055,9 @@ uint _mi_rec_pack(MI_INFO *info, register uchar *to, } } if (bit != 1) - *packpos= (char) (uchar) flag; + *packpos= (uchar) flag; if (info->s->calc_checksum) - *to++=(char) info->checksum; + *to++= (uchar) info->checksum; DBUG_PRINT("exit",("packed length: %d",(int) (to-startpos))); DBUG_RETURN((uint) (to-startpos)); } /* _mi_rec_pack */ @@ -1128,12 +1128,14 @@ my_bool _mi_rec_check(MI_INFO *info,const uchar *record, uchar *rec_buff, goto err; if (rec->length > 255 && new_length > 127) { - if (to[0] != (char) ((new_length & 127)+128) || - to[1] != (char) (new_length >> 7)) - goto err; - to+=2; - } - else if (*to++ != (char) new_length) + /* purecov: begin inspected */ + if (to[0] != (uchar) ((new_length & 127) + 128) || + to[1] != (uchar) (new_length >> 7)) + goto err; + to+=2; + /* purecov: end */ + } + else if (*to++ != (uchar) new_length) goto err; to+=new_length; } diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index a4f6e1291db..de42bdcd53d 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -815,8 +815,17 @@ static void setup_key_functions(register MI_KEYDEF *keyinfo) keyinfo->get_key= _mi_get_pack_key; if (keyinfo->seg[0].flag & HA_PACK_KEY) { /* Prefix compression */ + /* + _mi_prefix_search() compares end-space against ASCII blank (' '). + It cannot be used for character sets, that do not encode the + blank character like ASCII does. UCS2 is an example. All + character sets with a fixed width > 1 or a mimimum width > 1 + cannot represent blank like ASCII does. In these cases we have + to use _mi_seq_search() for the search. + */ if (!keyinfo->seg->charset || use_strnxfrm(keyinfo->seg->charset) || - (keyinfo->seg->flag & HA_NULL_PART)) + (keyinfo->seg->flag & HA_NULL_PART) || + (keyinfo->seg->charset->mbminlen > 1)) keyinfo->bin_search=_mi_seq_search; else keyinfo->bin_search=_mi_prefix_search;